Download the PHP package famelo/pdf without Composer
On this page you can find all versions of the php package famelo/pdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package pdf
Short Description Provides a quick and simple way to generate a PDF from a Fluid Template through the MPDF library
License LGPL-3.0-or-later
Informations about the package pdf
Famelo.PDF
This package provides a quick and simple way to generate a PDF from a Fluid Template through the MPDF library
Example:
This example will render a template located at 'resource://My.Package/Private/Documents/SomeDocument.html and convert it to PDF.
Page Format and orientation
By default pages will be rendered as a A4 Portrait. You can choose another format/orientation like this:
The MPDF library supports different page sizes with these keywords or an array containing 2 values for width + height:
- A0 - A10
- B0 - B10
- C0 - C10
- 4A0
- 2A0
- RA0 - RA4
- SRA0 - SRA4
- Letter
- Legal
- Executive
- Folio
- Demy
- Royal
- Ledger
- Tabloid*
All of the above values can be suffixed with "-L" to force a Landscape page orientation document e.g. "A4-L". If format is defined as a string, the final orientation parameter will be ignored.
*Ledger and Tabloid are standard formats with the same page size but different orientation (Ledger is landscape, and Tabloid is portrait). mPDF treats these identically; if you wish to use Ledger, you should specify "Ledger-L" for landscape.
Page numbering in Fluid
If you want to use mPDFs page numbering variables like {PAGENO} or {nbpg} you have to wrap them in a CDATA section, to keep Fluid from interpreting them as variables.
PDF Generator Implementation
By default this Library uses the MPDF library to generate the PDFs. But you can change the defaultGenerator through the Settings.yaml like this:
Feel free to create and use a generator for your favorite PDF Library And send me a Pull-Request if you think others might like to use it :)