'Version v8.0.0: SetImportUse()
Is there a bug or something?
$mpdf = new \Mpdf\Mpdf();
$mpdf->enableImports = true;
$mpdf->debug = true;
$mpdf->SetImportUse();
Call to undefined method Mpdf\Mpdf::SetImportUse() in /home/.../vendor/mpdf/mpdf/src/Strict.php:15
Solution 1:[1]
Found out it isn't needed in v8. In addition, importPage has different case than in v7. importPage is the correct one. So solved.
Solution 2:[2]
Solution For MPDF8
$pdf = new \Mpdf\Mpdf();
#$pages array with file paths /uploads/file1.pdf, /uploads/file2.pdf...
foreach($pages as $page)
{
$pagecount = $pdf->setSourceFile($page);
$import_page = $pdf->importPage($pagecount);
$size = $pdf->getTemplateSize($import_page);
$orientation = $size['width'] > $size['height'] ? "L" : "P";
$pdf->AddPageByArray(['orientation' => $orientation]);
$pdf->useTemplate($import_page);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pmax |
Solution 2 | DharmanBot |