From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Invoke Print File (Explorer)

Solved!
Go to solution

How can I invoke the print command that you get in explorer by right clicking a file in Windows Explorer?  I have a PNG file that I want to be printed, but I want to prompt the user on the printer to use, printer options, scaling, etc.  If you right click a PNG and choose print there is a nice window that comes up with a preview of the image and all kinds of settings like printer options.  I found by this command brings up the PhotoViewer and from there you can click print, but I'd like to go straight into the print dialog.

 

rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen "C:\temp\Temp.png"

 

I looked through the registry but couldn't find the command.

0 Kudos
Message 1 of 4
(4,812 Views)
Solution
Accepted by topic author Hooovahh

.NET should be able to handle this one way or another. The snippet was adapted from https://stackoverflow.com/questions/19662130/print-image-using-windows-print-image-dialog

 

png_print.png

 




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
Message 2 of 4
(4,752 Views)

A million kudos to you sir (in the form of one) if you are going to NI Week I'll buy you a beer to thank you.

0 Kudos
Message 3 of 4
(4,742 Views)

This works too Smiley Happy (only for files which have a Print menu in the Explorer popup menu, but that's the same for the .Net method, and in fact .Net calls exactly this function internally, well most likely ShellExecuteExW() but that is about the same).

 

WIN Print Document.png

Rolf Kalbermatter
My Blog
Message 4 of 4
(4,708 Views)