How to generate PDF files with PHP? [duplicate]

陌路散爱 提交于 2019-12-06 12:00:34

问题


I have some HTML that includes bolding, italics, small tag, big tag, blockquote tag, bullets, and numbered items. I need to convert it to PDF via PHP. I tried FPDF, but it was entirely too complex. I tried the html2pdf PHP library, which uses FPDF, but it was very buggy and unreliable. What do you recommend?

Note: Imagine your typical resume. I'm needing to format something like that.


回答1:


Take a look at FPDF




回答2:


I've had a lot of success with dompdf.

Make sure you have valid HTML though, or it can get into a loop. It's very simple to use - about 4 lines to convert an HTML file to a PDF.




回答3:


I have had good experiences with PrinceXML. Their rendering engine is very good. Passes acid2 and has good .svg support so you can include vector images instead of bitmaps to keep the .PDF relatively small (which is important when generating reports which need to be sent as an attachment).

(note that princexml is proprietary software).




回答4:


http://www.ros.co.nz/pdf/

I once used the above to turn incredibly complex architect's tile specifications into PDFs on a dynamic basis and it worked out well. I found the class very approachable and easily modifiable.



来源:https://stackoverflow.com/questions/323269/how-to-generate-pdf-files-with-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!