Re: Sending document to printer...
| From: | Enrico Weigelt | Date: | Fri, 16 Apr 2004 15:46:42 +0000 |
| Subject: | Re: Sending document to printer... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183638@lists.php.net to get a copy of this message | ||
* Alex Ortiz <alexortiz31@yahoo.com> [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: contact@metux.de
cellphone: +49 174 7066481
---------------------------------------------------------------------
-- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
---------------------------------------------------------------------