Import
class Import extends AbstractWriter
Methods
Load a PDF with version 1.4 or 1.5 of the Adobe Spec for use with Mpdf.
Display a page, or range of pages, from the loaded PDF in the PDF being rendered
Add a blank page to the PDF being rendered. Use in conjunction with $w->html()
.
Returns the current imported PDF page sizes (with $w->addPdf()
). The class handles the page sizes internally, so you shouldn't need to use this method in your templates.
Returns the current loaded PDF page IDs. The class handles the IDs internally, so you shouldn't need to use this method in your templates.
Details
at line 92
addPdf(string $path)
Load a PDF with version 1.4 or 1.5 of the Adobe Spec for use with Mpdf.
Example
// Import a PDF
$w->addPdf( __DIR__ . '/pdfs/load-document.pdf' );
// Load page #1 from PDF imported
$w->addPage(1);
// Import a 2nd PDF (you won't be able to load pages from PDF #1 after importing PDF #2)
$w->addPdf( __DIR__ . '/pdfs/load-another-document.pdf' );
// Load page #1 from 2nd PDF Imported
$w->addPage(1);
at line 126
addPage(int|array $id, array $args = [])
Display a page, or range of pages, from the loaded PDF in the PDF being rendered
Example
// Import a PDF
$w->addPdf( __DIR__ . '/pdfs/load-document.pdf' );
// Load page #1 from PDF
$w->addPage( 1 );
// Load a range of pages (pages 2 / 3 / 4 / 5) from the PDF
$w->addPage( [ 2, 5 ] );
// Load page #2 and set the top-margin to 20mm from the top of the page. This is useful when used with `$w->html()`
$w->addPage( 2, [ 'margin-top' => 20 ] )
at line 153
addBlankPage(array $args = [])
Add a blank page to the PDF being rendered. Use in conjunction with $w->html()
.
Example
// Load a new page in the generated PDF with a sheet size of 200mm wide by 400mm heigh
$w->addBlankPage( [ 'sheet-size' => [ 200, 400 ] ] );
at line 171
array
getPdfPageSize()
Returns the current imported PDF page sizes (with $w->addPdf()
). The class handles the page sizes internally, so you shouldn't need to use this method in your templates.
at line 182
array
getPdfPageIds()
Returns the current loaded PDF page IDs. The class handles the IDs internally, so you shouldn't need to use this method in your templates.