-2

Possible Duplicate:
Convert HTML + CSS to PDF with PHP?

How can I convert an HTML page (via $cURL or something) to a PDF file?

2

3 Answers 3

4

There are many scripts that do this, some of them:

HTML_ToPDF 3.5

HTML_ToPDF is a PHP class that makes it easy to convert HTML documents to PDF files on the fly. HTML_ToPDF grew out of the need to convert HTML files (which are easy to create) to PDF files (which are not so easy to create) fast and easily.

HTML 2 PDF - a PHP script

Get a HTML text and generate a PDF file to make it printer-friendly. This PHP script is based upon FPDF PHP script (www.fpdf.org). More info can be found on the home page (http://html2fpdf.sourceforge.net/).

dompdf

Handy for PHP developers looking to generate PDFs from their HTML content: dompdf is an HTML to PDF converter written entirely in PHP5. It has no dependencies on external libraries (e.g. html2ps) and it supports CSS 2.1.

2

Try: "wkhtmltopdf" it just work great (and its -open source-). It uses webkit engine (used by safari, chrome browsers) and it is very easy to use :

wkhtmltopdf stackoverflow.com/questions/1702834/ output.pdf

Try it! for Linux and Windows as well. Easy to install. If you use ubuntu, type:

aptitude install wkhtmltopdf

Then in your PHP just use the exec() command.

1

Have you checked out dompdf ?

1
  • It has many issues with rendering images and tables that have many rows.
    – Gogol
    Nov 17, 2014 at 7:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.