开发者

Convert php page to pdf on the fly [duplicate]

开发者 https://www.devze.com 2023-04-01 15:22 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Convert HTML + CSS to PDF with PHP?
This question already has answers here: Closed 11 years ago.

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.


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');


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.


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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消