Jump to content

_PrintImage UDF


Recommended Posts


I had the problem that I needed a way to print an image from AutoIt.

I searched the Forum, and only fount the print.au3 UDF, which seems to be only able to print text (didn't test it, but was said so in the topic).

I found a Rundll32 call which is able to print images with the Windows Image and Fax Viewer. I made a function to print the image the a specified printer.

Func _PrintImage($filename, $printer)
    If Not FileExists($filename) Then
        SetError(1, "Specified file couldn't be found")
    $command = "RunDLL32.EXE shimgvw.dll,ImageView_PrintTo /pt " & $filename & " " & $printer

I am sure it could be done with DllCall but I don't know where to start cause in MSDN i only found the RunDll32 call to use this function.

Maybe there is also a way to check if the specified printer is available, but also i didn't find out in the hurry how.

Hope you find it useful, and maybe someone can modify it to a DllCall Function.

Greetz Raindancer

Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer
Link to comment
Share on other sites

  • 1 month later...

Sorry to bump an old topic...

But I think it'd be nice if this were combined with the _FilePrint function that only prints text... Well, then you'd have to check for a lot of filetypes, well, maybe not. BLAH ! I'm too tired to think, just an idea... ;)

EDIT: Also, if you wanted to get around the problem of checking for the filetypes, then add an optional paremeter to say which file types could be printed... Again, just an idea, I'm sure there are many ways to do this :P

Edited by layer
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...