Using PHP to generate PDF methods in detail, PHP generated pdf detailed
Generating PDF files with PHP encoding is a very time-consuming task. In the early days, developers used PHP and fpdf to generate PDF files. But now, there are many libraries available, and you can generate PDF documents from the HTML files you provide. This makes the time-consuming work very simple.
FPDF
Fpdf is a PHP class that allows PDF documents to be generated using pure PHP, in other words, without using the Pdflib library. The F in Fpdf is free and free: You can use it in any situation and support customization to meet your specific needs, features:
1, you can select the Unit, page format and margins
2. You can manage headers and footers
3. Automatic paging
4. Wrapping and text alignment
5. Support Picture (jpeg,png,gif)
6, color-rich, support links
It also introduces some library of functions that can generate PDFs directly from HTML.
Dompdf
Dompdf convert HTML to PDF. Dompdf follows the CSS2.1 HTML layout, which is a rendering engine written in PHP. Dompdf is style-driven: it downloads and reads the value of the style property of the outer-chain style sheet, inline style, and HTML element. Most HTML-visible properties are also supported.
Characteristics:
1. Handle most CSS2.1 and little CSS3 attributes, including @import, @media & @page rules
2. Support the most visible attributes of HTML 4.1
3, support external style sheet, including local or http/ftp link (through Fopen-wrappers)
4. Support complex table structure, including row and column Span,separate & collapsed border models and standalone cell style
5. Support images (GIF, PNG, BMP & JPEG)
6. Do not rely on other PDF function libraries
TCPDF
Tcpdf can also be used to generate PDF documents, and it is an open source PHP class library.
The Tcpdf project began in 2002 and is now freely available to thousands of people. TCPDF is a free Libre Open Source software (FLOSS).
Characteristics:
1. Basic functions are not dependent on other PDF libraries
2. Standard page format, support page format customization, margin customization and unit metering
3, Support UTF-8 encoding and text direction from right to left language.
4, Support Truetypeunicode, Opentypeunicode, TrueType, OpenType, Type1 and CID-0 fonts
5, support font subset, and provide methods to publish some XHTML + CSS code, Javascript and Forms
6, support the conversion of pictures and graphics
7. Support page compression (requires php-zlib extension)
8. Automatically manage headers and footers
More features please poke: more
From the list of comments in the original text, I also scoured the relevant sites and open source projects:
Wkhtmltopdf (commented that HTML is the standard for generating PDFs): https://code.google.com/p/wkhtmltopdf/
Https://github.com/mreiferson/php-wkhtmltox
Pdfservices (this you explain, poke open know): http://www.pdfservices.net/
http://www.bkjia.com/PHPjc/946745.html www.bkjia.com true http://www.bkjia.com/PHPjc/946745.html techarticle Using PHP to generate PDF details, PHP generated PDF details using PHP code to generate PDF files is a very time-consuming task. In the early days, developers used PHP and fpdf to generate PDF files. But ... ..