From: Michael Calkins on

I have found various online tools that do this but nothing that has documented it as a tutorial so I can understand it. I found the html_to_pdf.inc.php script that is entirely undocumented so I am not sure how to use it exactly.
I am trying to export generated HTML (an invoice for a customer) to a saveable PDF that is downloaded. Any ideas?

From,Michael Calkinsmichaelcalkins(a)live.com360-941-6750

From: Ashley Sheridan on
On Wed, 2010-08-04 at 17:33 -0700, Michael Calkins wrote:

> I have found various online tools that do this but nothing that has documented it as a tutorial so I can understand it. I found the html_to_pdf.inc.php script that is entirely undocumented so I am not sure how to use it exactly.
> I am trying to export generated HTML (an invoice for a customer) to a saveable PDF that is downloaded. Any ideas?
>
> From,Michael Calkinsmichaelcalkins(a)live.com360-941-6750
>
>


As far as I'm aware, it's not as simple as it seems. Basically, HTML is
subject to interpretation by the user agent (browser) so doesn't look
consistent on all platforms. A PDF is meant to follow a fairly rigid
format that defines exactly how the output should be displayed (as it's
a presentational format)

What you could do though, if you're already producing the HTML output,
is to use the FPDF class to create the PDF you need, with appropriate
calls made from within your existing PHP code.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Bastien Koert on
On Wed, Aug 4, 2010 at 6:06 PM, Ashley Sheridan
<ash(a)ashleysheridan.co.uk> wrote:
> On Wed, 2010-08-04 at 17:33 -0700, Michael Calkins wrote:
>
>> I have found various online tools that do this but nothing that has documented it as a tutorial so I can understand it.  I found the html_to_pdf.inc.php script that is entirely undocumented so I am not sure how to use it exactly.
>> I am trying to export generated HTML (an invoice for a customer) to a saveable PDF that is downloaded.  Any ideas?
>>
>> From,Michael Calkinsmichaelcalkins(a)live.com360-941-6750
>>
>>
>
>
> As far as I'm aware, it's not as simple as it seems. Basically, HTML is
> subject to interpretation by the user agent (browser) so doesn't look
> consistent on all platforms. A PDF is meant to follow a fairly rigid
> format that defines exactly how the output should be displayed (as it's
> a presentational format)
>
> What you could do though, if you're already producing the HTML output,
> is to use the FPDF class to create the PDF you need, with appropriate
> calls made from within your existing PHP code.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

You can also look at dompdf from digitaljunkies.ca

--

Bastien

Cat, the other other white meat
From: Scott Teresi on
> I am trying to export generated HTML (an invoice for a customer) to a saveable
> PDF that is downloaded. Any ideas?

I've found a very easy unix command for generating PDF's:

code.google.com/p/wkhtmltopdf

[The PHP list wouldn't let me send this with "http://" in front of the URL.]

It will turn any web page into a PDF and was easy to install and use and has
documentation. (I call it from a PHP script.) It renders the web page using
a WebKit library that's included in the source, and there are lots of
options for how to tweak the rendering engine.

Scott


 | 
Pages: 1
Prev: multi thread work?
Next: mytrash mail thing