Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

How do I print from a remote webserver using a PHP script directly to a local network printer?

I have a web-based PHP script used for referring patients to an Emergency Department.  The script is hosted on a remote server and the hospitals access it via a URL.  I need the script to be able to print out info on a referred patient onto the hospital's local network printer.  How do I go about adding this functionality to the script?  The script is running on a linux server/Apache using PHP and MySQL.  Is there a printer class somewhere that I can include in the script?  I do not need a code snippet/class that merely makes a page "printer-friendly."  I need a class that sends the data directly to the printer for printing without having a pop-up printer window.
0
ErDrRon
Asked:
ErDrRon
1 Solution
 
IsisagateCommented:
I think you will have to look at a Java Applet to get this done... Javascript can only pop up the printer dialog and requires interaction from the user.
0
 
IsisagateCommented:
Though if that works for you... calling

window.print();


will do it then...
0
 
ErDrRonAuthor Commented:
Is there a Java applet out there that already does this?  I'm afraid I'm not Java-savvy.

Ron
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ErDrRonAuthor Commented:
I am trying to avoid forcing the user to interact with a pop-up Windows printer properties dialogue box.  i want the print to happen seamlessly and transparently in the background.

Ron
0
 
nizsmoDeveloperCommented:
There is unfortunately no way of doing this in javascript as I know of, since this can be used quite abusively (think about if you go to www.someaddress.com) with your javascript enabled browser connected to a turned-on printer, the next minute you realize you have printed 100 copies of some image that was specified in the javascript code.

Therefore confirmation is required for printing as far as I know.
0
 
IsisagateCommented:
Don't know about a free or specific applet but the Library one might use to write the applet would probably be JPrint http://www.nevaobject.com/_docs/_jprint/JPrint.htm

it would allow Java to interface with a print, so you might try searching google for something using this API that prints the current web page... or loads a web page and prints it... Basically speaking you need some sort of client side activex control, Java applet, maybe flash app to do this... javascript itself can't do it because of the security problems.
0
 
grahamnonweilerCommented:
The ScriptX control from Mead&Co is an activeX control that handles exactly what you want to do - but its not free and obviously only runs on Windows and IE.

http://www.meadco.com/scriptx/index.asp

If you do not want to use an ActiveX control (or pay for it) then there is no other way to print from a web page other than by using the Javascript "window.print()" command.

Using a Java applet will have similar downsides to an ActiveX control in that not everybody has Java installed on their PC.

We spent considerable time a couple of years ago trying to handle the very same thing - we ended up going with ScriptX!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now