Hi I would like to print off a report server side and not client side. I saw that php_printer.dll is how you used to do it but I could not find a binary file for it. How would I print server side. This is for an inventory system where the form will be filled out on the floor and than automatically printed in the stock room.
write the file out to the filesystem (fopen, fputs, fclose) and then shell_exec(lp -c file)
PHP's printing functionality is documented here: http://www.php.net/manual/en/book.printer.php.
You'll notice under the "Installation" section of that documentation that this extension is not included in the out-of-box PHP installation, but rather is part of the PECL archive.
For whatever weird reason, the PECL archive no longer has a compiled DLL for that extension... but if you search around, you nevertheless can find pre-built DLL's provided by third-parties.
I would NOT trust one provided by any random third-party, because you can't be sure that the DLL includes no malicious code! However, the PHP website itself has a relatively-recent archive of all PECL DLL's which you can download here: http://us.php.net/get/pecl-5.2.6-Win32.zip/from/a/mirror.
I found all the existing native PHP variants not very promising. So here is what I do for serverside report printing:
- Generate the Reports as PDF file (I use Jasper Reports for that)
- Printing the File via Java (Using the Java-Bridge fromn the ZendServer product for that
For 2 I wrote a small Java-Class that is doing the printing of the PDF-File. I use this class directly from my PHP Script via the Java-Bridge.
I can provide you with the Java-Class and the PHP-Code if needed