Creating a program on an intranet that generates a report, I am wanting to send the report to a printer on the server for printing. The printer is Dot Matrix and resides attached to the printer. I can get the report to print but it changes the users default printer to the printer attached to the server. Basically on the website people fill out the form a report is generated and then a butto开发者_C百科n is clicked that says print and I want it to go to the printer on the server and print without changing the users settings. Can you give me a few examples of code. The site is php but I will run with anything I can get to work.
Thanks
one way to do it is write a bash script that will look for files in a dir and then print and delete them when detected.
you can find more info from this http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=printing+from+bash+script
php app will write the report to this special folder. bash script then takes over
monitor folder -> find files -> send to printer -> delete
This will keep the code pretty independent and easy to maintain.
I think you need to add a print button to the page that communicates with the server and makes the server side script print the contents of the page. Since you generate the report on the server, your server side script should already know what to print. Printing on the server depends on which OS you are using on the server side. Just tell what is the server side OS to recommend OS specific printing directions.
If you are on Windows on the server side, you can use the printer extension functions to print the reports from there: http://www.php.net/manual/en/book.printer.php
精彩评论