Printable Output
am 16.11.2007 10:15:33 von Alan M DunsmuirIs there a standard technique, in a PHP/MySQL Web Application, for users
to be provided with printable-quality output - e.g. business invoices -
created for them on the fly?
Is there a standard technique, in a PHP/MySQL Web Application, for users
to be provided with printable-quality output - e.g. business invoices -
created for them on the fly?
On Fri, 16 Nov 2007 10:15:33 +0100, Alan M Dunsmuir
> Is there a standard technique, in a PHP/MySQL Web Application, for users
> to be provided with printable-quality output - e.g. business invoices -
> created for them on the fly?
Yes, create a pdf. There are different packages for this, most of them
pretty easy to use.
--
Rik Wasmus
Rik Wasmus wrote:
> On Fri, 16 Nov 2007 10:15:33 +0100, Alan M Dunsmuir
>
>> Is there a standard technique, in a PHP/MySQL Web Application, for
>> users to be provided with printable-quality output - e.g. business
>> invoices - created for them on the fly?
>
> Yes, create a pdf. There are different packages for this, most of them
> pretty easy to use.
Or postcript.
I settled on that because a few tests showed that a linux CUPS sysem
could take postcript and fire it straight at a postcript printer very
efficiently.
If printing on the server, consider that. If printing from users
browsers, use PDF.
Rik Wasmus wrote:
> On Fri, 16 Nov 2007 10:15:33 +0100, Alan M Dunsmuir
>
>> Is there a standard technique, in a PHP/MySQL Web Application, for
>> users to be provided with printable-quality output - e.g. business
>> invoices - created for them on the fly?
>
> Yes, create a pdf. There are different packages for this, most of them
> pretty easy to use.
Which packages would you suggest I look at?
"Alan M Dunsmuir"
news:fhjn3h$sfq$1$8300dec7@news.demon.co.uk...
> Is there a standard technique, in a PHP/MySQL Web Application, for users
> to be provided with printable-quality output - e.g. business invoices -
> created for them on the fly?
Nearly EVERY web page is "printable quality".
Beyond that - you can use CSS's @ functions to specify how to handle printed
output.
Could you be more specific?
btw - cross-posting to both PHP groups is a bit of a no-no.
Alan M Dunsmuir wrote:
> Is there a standard technique, in a PHP/MySQL Web Application, for users
> to be provided with printable-quality output - e.g. business invoices -
> created for them on the fly?
I don't know about "standard", but for one customer I am creating .pdf
files on the fly. He can then forward them by email or print them as he
wishes, using the integration of Adobe and Outlook Express (windows).
The library is public domain and can be found at http://www.ros.co.nz/pdf/
You will not like how page throws are handled! You can't know you need
to take a new page, until you over stepped the bottom of the page. The
work around is ugly - you detect that you are now on a new page, discard
back to the last check point, head the new page, and then output the
stuff you threw away again. Yeuk, but it works.
I ended up writing an adapter pattern so I could write lots of
do {
$text = "Please find below q.... ": // build a paragraph in $text
$text .= ".\n";
$pdf->ezText($text,$size,$opts); // add it
} while ($pdf->endsOnNewPage($this,'headpage'));
loops to send out the bits between possible break points.
It means I can forget all about driving printers, fax machines, or
emailing the results. I have included his (colour) letterhead, with its
image, so he prints on plain paper, with no line-up problems. The code
even get the addresses to appear in the window of the envelope every time.
Regards
Ian
Sanders Kaufman wrote:
>
> Nearly EVERY web page is "printable quality".
> Beyond that - you can use CSS's @ functions to specify how to handle printed
> output.
That view seems to miss the point rather badly.
Apart from a number of basic deficiencies stemming from the underlying
specification of HTML/CSS, there are the problems caused by varying
renderings on differing PC/Mac configurations and by the use of
different browsers.
A pre-formatted PDF sidesteps these problems neatly.
Ian Hobson wrote:
>> The library is public domain and can be found at http://www.ros.co.nz/pdf/
>
>
Thanks. That seems to be exactly what I'm looking for, with the added
advantage of my not having to trouble my Web Server Host by asking him
to load additional software for me.
"Alan M Dunsmuir"
news:fhk2th$55v$1$8302bc10@news.demon.co.uk...
> Rik Wasmus wrote:
>> Yes, create a pdf. There are different packages for this, most of them
>> pretty easy to use.
>
> Which packages would you suggest I look at?
If you search the PHP docs for "pdf" you'll find that there is some pretty
decent stuff built-in.
It may require that a module of some kind be compiled into the installation,
but I understand that's a relatively simple thing to do.
"Alan M Dunsmuir"
news:fhm3vn$p0s$1$8300dec7@news.demon.co.uk...
> Sanders Kaufman wrote:
>>
>> Nearly EVERY web page is "printable quality".
>> Beyond that - you can use CSS's @ functions to specify how to handle
>> printed output.
>
> That view seems to miss the point rather badly.
>
> Apart from a number of basic deficiencies stemming from the underlying
> specification of HTML/CSS, there are the problems caused by varying
> renderings on differing PC/Mac configurations and by the use of different
> browsers.
>
> A pre-formatted PDF sidesteps these problems neatly.
Yeah - it's very feature rich... to the point of being bloated.
That's why PDF and RTF are third-party plug-ins, and why their features were
not included in HTML specifications.
There was some discussion about it during the drafting phase - but it became
readily apparent that trying to make every browser page into a feature-rich
desktop publishing application was just too much.
I've been using the library for a few years now. It's really buggy, but if
you know how to handle the bugs and how to work around them then this PDF
library has (almost) everything you need... It's small and great! :)
Let's hope that the developer will pick up the project again, as he
mentioned on the website that he will do for over a year ago... We're all
waiting for a new release! Come on! :)
/Krister
Alan M Dunsmuir
> Ian Hobson wrote:
> >> The library is public domain and can be found at http://www.ros.co.nz/pdf/
> >
> >
> Thanks. That seems to be exactly what I'm looking for, with the added
> advantage of my not having to trouble my Web Server Host by asking him
> to load additional software for me.
--
* Ing. Krister Karlstrom, Zend Certified Engineer *
* Systemutvecklare, IT-Centralen *
* Arcada - Nylands Svenska Yrkeshogskola *
* Jan-Magnus Janssons plats 1, 00550 Helsingfors, Finland *
* Tel: +358(20)7699699 GSM: +358(50)5328390 *
* E-mail: krister.karlstrom@arcada.fi *