RE: [PHP] Sending document to printer...
I do this fairly frequently -- basically, I just have word on a windows server and use COM objects to send stuff over to the printer, using word to do the formatting. -- jon --- jon roig web developer email: [EMAIL PROTECTED] phone: 888.230.7557 -Original Message- From: Enrico Weigelt [mailto:[EMAIL PROTECTED] Sent: Friday, April 16, 2004 8:47 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sending document to printer... * Alex Ortiz <[EMAIL PROTECTED]> [2004-04-14 18:28:18 -0500]: > I'm looking for some ideas to send data directly to printer, > considering the user runs a browser (client side), while the PHP code > runs at apache server (server side). PHP has some printing functions, > but only for the Windows version. Printing in professional environments is a little bit more complex than it seems for the standard windows user. Spooling and printjob generation are fundamentally two different things Windows mixes this together and only provides a very limited API for sending screen-paint operations to print job. So if we want to code a good printing extension (which I'd really welcome and I'll really like to contribute to), we have to keep these things separated. For print spooling, lpr gives and simple easy-to-use interface. But of course this is quite limited and only applicable for adding new jobs locally. (more than that is possibly, but not easy to use IMHO). Probably CUPS supplies some suitable client libs, but I didn't have a look at them, so I cant tell you anything about them. I would recommend writing a very small lib for doing normal print queue management in a platform independent way. On gtk there were also some folks requesting such an API (they wanted to include it into gtk, which was gladly refused) If there're some more people willing to work on that I'll start a new project for that, which also produces a php-binding. I'll also offer to host some project resources like website, maillists, etc and recruit these folks from gtk for it. But I won't do evryhing by myself :) Okay, this was print-spooling. Job-Generation is another topic. This really depends on your datasource and the languages your target printers understand. Most of the world (Unix, Apple, almost all better printers ...) will understand PS or PDF and probably SVG. Windows and windows-only-printers go their own way and only understand WMF, but could use gs to render PS/PDF to WMF. There're many libs out there for generating such formats, i.e. pdflib or cairo. For rendering HTML you'll maybe try to get gecko pdf backend running or pipe it through html2ps. For supplying a windows-like printing API probably a mixture of my recommended spooling API and cairo would be suitable. > My HTML/PHP program process some input data from a form, then open a > new window with the resulting data. The user needs to print this > resulting data in a blank sheet, but the browser (MS Internet > Explorer) prints some headers and footers besides the data. Well, this is a IE problem. BTW: where should the printing happen ? On the webserver or the client ? These are fundamentally different. Printing on the server was the topic I was talking about. If you're talking about printing from the webbrowser and fixing IE's printing problems - this is not a PHP issue! regards, -- - Enrico Weigelt== metux IT services phone: +49 36207 519931 www: http://www.metux.de/ fax: +49 36207 519932 email: [EMAIL PROTECTED] cellphone: +49 174 7066481 - -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting -- - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.657 / Virus Database: 422 - Release Date: 4/13/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.657 / Virus Database: 422 - Release Date: 4/13/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending document to printer...
* Alex Ortiz <[EMAIL PROTECTED]> [2004-04-14 18:28:18 -0500]: > I'm looking for some ideas to send data directly to printer, > considering the user runs a browser (client side), while the PHP code > runs at apache server (server side). PHP has some printing functions, > but only for the Windows version. Printing in professional environments is a little bit more complex than it seems for the standard windows user. Spooling and printjob generation are fundamentally two different things Windows mixes this together and only provides a very limited API for sending screen-paint operations to print job. So if we want to code a good printing extension (which I'd really welcome and I'll really like to contribute to), we have to keep these things separated. For print spooling, lpr gives and simple easy-to-use interface. But of course this is quite limited and only applicable for adding new jobs locally. (more than that is possibly, but not easy to use IMHO). Probably CUPS supplies some suitable client libs, but I didn't have a look at them, so I cant tell you anything about them. I would recommend writing a very small lib for doing normal print queue management in a platform independent way. On gtk there were also some folks requesting such an API (they wanted to include it into gtk, which was gladly refused) If there're some more people willing to work on that I'll start a new project for that, which also produces a php-binding. I'll also offer to host some project resources like website, maillists, etc and recruit these folks from gtk for it. But I won't do evryhing by myself :) Okay, this was print-spooling. Job-Generation is another topic. This really depends on your datasource and the languages your target printers understand. Most of the world (Unix, Apple, almost all better printers ...) will understand PS or PDF and probably SVG. Windows and windows-only-printers go their own way and only understand WMF, but could use gs to render PS/PDF to WMF. There're many libs out there for generating such formats, i.e. pdflib or cairo. For rendering HTML you'll maybe try to get gecko pdf backend running or pipe it through html2ps. For supplying a windows-like printing API probably a mixture of my recommended spooling API and cairo would be suitable. > My HTML/PHP program process some input data from a form, then open a new > window with the resulting data. The user needs to print this resulting data > in a blank sheet, but the browser (MS Internet Explorer) prints some headers > and footers besides the data. Well, this is a IE problem. BTW: where should the printing happen ? On the webserver or the client ? These are fundamentally different. Printing on the server was the topic I was talking about. If you're talking about printing from the webbrowser and fixing IE's printing problems - this is not a PHP issue! regards, -- - Enrico Weigelt== metux IT services phone: +49 36207 519931 www: http://www.metux.de/ fax: +49 36207 519932 email: [EMAIL PROTECTED] cellphone: +49 174 7066481 - -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting -- - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending document to printer...
Hi. I'm looking for some ideas to send data directly to printer, considering the user runs a browser (client side), while the PHP code runs at apache server (server side). PHP has some printing functions, but only for the Windows version. My HTML/PHP program process some input data from a form, then open a new window with the resulting data. The user needs to print this resulting data in a blank sheet, but the browser (MS Internet Explorer) prints some headers and footers besides the data. I already know how to configure IE to take away the headers and footers manually, but need to do it automatically, because the user needs IE to print headers and footers in all other pages. I tried to do it with the following JavaScript: // JScript/ActiveX - "Modify IE Headers and Footers" t = new ActiveXObject("WScript.Shell"); t.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",""); t.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",""); This script works perfect, but must exist in client side because updates the windows registry. I mean, doesn't run from server side, and additionally changes the headers/footers permanently, so the user needs to run a "set headers/footers" script and then an "unset headers/footers" script, and so on. Then, I need something to PHP (or JavaScript, or whatever), to send the data directly to printer, so I disallow the user to make mistakes, and get for him a transparent behavior. Thanks in advance for any idea. Best regards, Alex Ortiz. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php