Importing files & Templates
(mPDF ≥ 2.3)
Using an extension of mPDF, pages from external PDF files can be imported into ‘templates’ and used throughout the current document. This can be used for:
- page templates e.g. statements or invoices
- letterheads (see also Headers & Footers)
- a whole document template
- create thumbnails as handouts etc. from a document you have produced
Tip: mPDF imports all embedded fonts required for the document, even if they are the same as the ones used in the document being written. Try to keep the file size of the external source PDF file down to a minimum.
Note: On limited testing, mPDF appears to import any PDF file (with a version ≤ 1.4, or one produced by mPDF) as long as it is not password protected. Text and images are imported, but links, bookmarks etc. are not. LZW encoding is supported from mPDF 4.3 onwards
Note: Prior to mPDF 4.3, this required calling mPDFI()
. The functions have now been incorporated
into the main \Mpdf\Mpdf
class, Until mPDF 8.0, you must use
SetImportUse() to
enable them.
See
Since v8.0
- setSourceFile() - Specify the source PDF file used to import pages into the document
- importPage() - Import a page from an external PDF file
- useTemplate() - Insert an imported page from an external PDF file
Until v8.0
- SetImportUse() - Enable the use of imported PDF files or templates
- SetSourceFile() - Specify the source PDF file used to import pages into the document
- ImportPage() - Import a page from an external PDF file
- UseTemplate() - Insert an imported page from an external PDF file
Common
- Thumbnail() - Print thumbnails of an external PDF file
- SetPageTemplate() - Specify a page from an external PDF file to use as a template
- SetDocTemplate() - Specify an external PDF file to use as a template