Re: Printing Question
| From: | Robert Cummings | Date: | Sat, 26 Jan 2008 18:09:18 +0000 |
| Subject: | Re: Printing Question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268159@lists.php.net to get a copy of this message | ||
On Sat, 2008-01-26 at 15:19 +0100, Floor Terra wrote:
> On Jan 26, 2008 1:03 PM, Peter Jackson <tasmaniac@iprimus.com.au> wrote:
>
> > Whats the best way to do formatted printing via php?
>
> You could try PDFlib().
> Draw your reports to landscape formated pdf's and print them.
>
> > Oh and I'm aiming for a unix/windows outcome.
>
> pdf is platform independent.
>
> I hope this is what you meant.
I recently had a request from a client to create a button on client
search results that would generate page that could print off a mailing
envelope for each selected client. They wanted to run a print batch on a
couple of thousand clients. So I used HTML, CSS. Specifically to force
page breaks while printing I used the following:
<div style="page-break-after: always"></div>
Note that you can't use a span for the above css attribute. Then for
various dimensions of the envelope and return address etc, I used CSS
attributes defined by the inches unit. I'll admint I whipped it up quick
and dirty using tables (sorry, tables are just simpler for generating
quick layouts than divs are... talk to the hand smelly purists :)
So something like the following:
table.envelopeLayout
{
width: 13in;
}
table.envelopeLayout td.returnAddress
{
height: 3in;
}
So this looked nice in the browser, but when they went to print it got
all borked when they told IE to use landscape mode. So I told them to
upgrade to a real browser (Firefox (though I prefer Opera :)). After
that they told me it worked perfectly. So, to make the point... you do't
need PDF, HTML will do. BTW, I did this all remotely and someone on-site
did a couple of print tests to give me feedback. I never even got to see
their new fancy schmancy printer :)
I've done other print stuff via the browser before too... such as state
driving certificates for presentation in court. Never had a problem once
the layout and print configuration were refined.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'