in reply to Print a jpg file to a printer (on Windows)

You will have to get low level using the win32 api. The easiest call that you can make is the ShellExecute (in shell32.dll) function which examines the extension of the data file and checks the registry to determine the application handling the extension.
Then it starts the application and instructs it in this case to print the file.Most applications will send the printout to the default printer.So if you set the default printer as the network printer it should be send there by the registered application.
But note that this works IF the registered application sends it to the printer with no user intervention,which maybe requires some tweaking.

The Win32::API module interfaces with the system dlls and calls the functions residing in them. Since the dlls are written in C it means getting deep into unmanaged code with,of course, all its associated risks!
You will have to allocate and deallocate memory and then parse the printing structures using padding specific to the the windows architecture.Which means,amongst others,abusing the 'pack' and 'unpack' functions!Pack to create the structures needed and subsequently passing them into the dll's.And 'unpack' for parsing the resulting structures!

But since in this case you only have to call on function it might be a bit easier. If you don't want to use the Shellexecute function then you can use GDI calls (much much harder) Start by looking the MSDN website. gdi for jpg
Some time ago I wrote a program that manipulated the printer queue as i wanted to capture the output of report generated on unix server and sent, using special escape codes of the terminal emulator, to the local printer ie. the default windows printer.
The program monitors the windows printer queue,captures and embeds html tags to the report and redirects it to Internet explorer.
If you are interested in that stuff PM me
  • Comment on Re: Print a jpg file to a printer (on Windows)