Fotis Andritsopoulos <fa*****@telecom.ntua.gr> wrote in
news:42************@telecom.ntua.gr:
Hello,
I tried to find out how can I print a document through php. What I want,
is to add a "print button" within a web page (something like the "Print"
button of the explorer, but within the page).
I tried a little bit with the printer_open() function of php but with no
luck. I red the docs, but I couldn't understand which functions are
required to print.
printer_open();
... what else ???
printer_close();
Thanks a lot!
Fotis.
The "printer" family of functions is normally used to write to the local
printer attached to the server running PHP or to a network print device.
If that works for you (ie, the server is physically located at your
facility), then you can use these functions. Keep in mind this will only
work if the server running PHP is a windows machine.
A better solution might be to use a PDF library (
http://www.ros.co.nz/pdf).
When you click the "print button" on your page, you'll launch a script that
creates the PDF and displays it in, maybe, a new browser window using
Adobe Acrobat on the client's machine. There are many examples available.
I believe this project has been moved to sourceforge where there are Q&A
forums available.