Print Images using CFEXECUTE

297 views Asked by At

I have an image gallery running in ColdFusion. I would like to be able to print the images, without generating a PDF first. I believe this can be done using CFEXECUTE.

Basically there will be a session storing the images and when the proceed button is clicked, CFEXECUTE will kick in and use Windows Photo Viewer to open the image and the print all of them, is this possible? Can all images be opened and printed in the same queue or do they have to be opened one by one?

Update 1:

My issue is with the arguments that go in CFEXECUTE. I have opened cmd.exe and then in the arguments I need to open Windows Photo Viewer which is not an exe but a DLL. This is where the issue lies for me, and then would I put the path to all the images in the arguments as well?

Update 2:

This is the code I have tried:

<cfset args = []>
<cfloop index="thisitem" from="1" to="#arrayLen(session.orderbasket)#">
<cfset args[thisitem] = '#mainpath#\#session.orderbasket[thisitem].path#\#session.orderbasket[thisitem].image#'>
</cfloop>
<cfset printer = "DP-DS620">
<cfloop index="thisitem" from="1" to="#arrayLen(session.orderbasket)#">
<cfexecute name="C:\Windows\System32\cmd.exe" arguments="rundll32 C:\Program 
Files\Windows Photo Viewer\PhotoViewer.dll '#args#' '#printer#'" 
timeout="99"></cfexecute>
</cfloop>

I get this error:

Complex object types cannot be converted to simple values.

Any help regarding the correct syntax would be greatly appreciated.

0

There are 0 answers