Helpful Information
 
 
Category: ColdFusion Development
cold fusion printing

I need a script, function, anything that will do the following:

upon a button being pushed it makes a server call generating some data to be printed. It will then generate a form (hidden and completely unseen by the user), prints it and returns to its normal state. The real problem is I need it to print client-side rather than server-side. Any ideas would be much appreciated!!!

Hi Jediwheatie,

unfortuantly I dont think its possible with CF. Because CF is a server side utility it can't really get access to a clients printer, if you could that would be a really bad idea. Think about all the ad's you would get punted through.. You can do it with Javascript, the printer box will apear asking the user if they want to print or not.

It's a very long shot but maybe you could open a socket to the client's machine and send the data directly to the printer, but then i wouldn't know where to start. You'd also have to worry about things like OS and etc.

I'd stick to javascript and use the print function for this. :)

Hope this helps,
Mark.

Unfortunately however, javascript doesn't have the functions that I am requiring, unless of course, I don't know as much Javascript is as required. I need to click a button, make a coldfusion server call, return to the same page, and while that is happening, some script or anything to print something to a printer(never seen on screen). Anytime you generate a window and try to close it, it will then ask "The browser you are currently using is trying to be closed, Is this ok?" which I cannot have as a security risk. Let me know if you know any javascript functions to allow this type of functionality.

:) you don't need to know much Javascript. maybe i didnt explane very well. use CF to generate your new page with a print function set to print OnLoad, the page will then be printed when it's done loading (with the users ok).

The rest I have no dout you can and should be do with CF, all I was trying to say what that CF cant access the printer, you need Javascript to do this for you.

Take care,
Mark.

thanks.

Very welcome Jedi, if you need any help i'd be happy to. I dont know much CF though :).

Mark.










privacy (GDPR)