3

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

I want to convert page like this http://alexking.org/projects/html-resume-template/demo/resume.php to pdf on the fly by a link inside the page, I tried dompdf but failed to have the result.

0

5 Answers 5

3

I has some success with HTML2PDF, give it a try. Example:

$content = get_include_contents('/resume.php');

require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->WriteHTML($content);
$html2pdf->Output('example.pdf');
2
  • if resume.php page on my root, how I can use this to convert the the page resume.php from another php file?
    – Pipo
    Sep 1, 2011 at 11:04
  • See my edited answer for an example.
    – ldiqual
    Sep 1, 2011 at 12:31
0

Check out Zend_PDF(), which provides all possibilities. If you need a bigger freedom and other formatting, I'd recommend to use latex and a latex2pdf-call, but this one might be a bit much for what you want to achieve.

Unfortunatly, I haven't seen a decent html2pdf-generator so far.

1
  • It's a PDF generator, it doesn't take HTML/CSS as input Sep 1, 2011 at 10:51
0

What about http://www.php.net/manual/en/pdf.examples-basic.php ?

1
  • It's a PDF generator, it doesn't take HTML/CSS as input Sep 1, 2011 at 10:51
0

I've found this to be very good http://code.google.com/p/wkhtmltopdf/. It uses the webkit engine.

-1

Personally I use TCPDF. It fully supports UTF-8 and you don't need any external libraries to use it.

3
  • It's a PDF generator, it doesn't take HTML/CSS as input Sep 1, 2011 at 10:51
  • Call it as you want but it's able to solve the problem...
    – matino
    Sep 1, 2011 at 11:05
  • TCPDF is very good but it's writeHTML() functionality is limited. It doesn't do a great job with tables for example and ignores CSS. I found wkhtmltopdf and Snappy (github.com/KnpLabs/snappy) to be a lot better.
    – AMc
    Jul 19, 2013 at 13:11

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