SetSourceFile() (until 8.0)
(mPDF ≥ 2.3 && mPDF < 8.0)
SetSourceFile – Specify the source PDF file used to import pages into the document
Note: This method was superseded by setSourceFile() in mPDF 8.0.
Description
int SetSourceFile ( string $file )
Specify the source PDF file used to import pages into the document.
Parameters
- $file
-
This parameter specifies the source PDF file used to import pages into the document.
Note: $file should be a relative path to a local file.
Return Value
SetSourceFile() returns the number of pages in the source file.
Changelog
Version | Description |
---|---|
2.3 | Function was added. |
8.0 | Function was removed in favour of setSourceFile(). |
Examples
Example #1
<?php
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
// Enable imports
$mpdf->SetImportUse();
// Specify a PDF template
$pagecount = $mpdf->SetSourceFile('logoheader.pdf');
// Import the last page of the source PDF file
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->WriteHTML('Hello World');
$mpdf->Output();
See Also
- SetImportUse() - Enable the use of imported PDF files or templates
- Thumbnail() - Print thumbnails of an external PDF file
- ImportPage() - Import a page from an external PDF file
- UseTemplate() - Insert an imported page from 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