Printing an image file

Hi all. Newbie here.

I am trying to print an image file from my desktop and was wondering if anyone could point me in the right direction on the steps necessary to do this.

Essentially I have a file on my Mac desktop in the Downloads directory called testimage.jpg.

I simply want to load it and print it to the printer.

I have seen lots of info about printing but nothing that mentions loading a file from the computer.

Any help would be appreciated.


Printing is accomplished the same way as drawing on the screen – only instead of drawing to a canvas’ graphics object, you draw into a printer’s graphics object.

So you just draw the picture the same way you would if you were drawing it into a graphics object (see graphics.drawPicture in the documentation).

See the Open method of the Picture object :

Then when you got the picture from the file, use DrawPicture into the g graphics printer object :

Beauty! Thanks guys, I will give this a shot.

I have almost got it, thanks to you guys!! Your help was perfect.

The only thing left is that I am not able to just set the path to the image rather than ‘open the folder’ selection box.

I can get it working just fine when I select the image file using this:
picFile = GetOpenFolderItem("")

But I prefer to just open the file itself using the absolute file path, but I cannot get this working. Here is what I am using:
picFile = GetFolderItem(“Macintosh HD/Users/brad/Desktop/testimage.pdf”)

I have tried all sorts of permutations of this. Does anyone know what the correct file path string should properly look like for Mac Os X?

The help site is your friend. See SpecialFolder which points to desktop and other common places automatically :

Your example :

picFile = GetFolderItem("Macintosh HD/Users/brad/Desktop/testimage.pdf")

With SpecialFolder :

picFile = SpecialFolder.Desktop.child("testimage.pdf")