change impl to avoid compilation issue
This commit is contained in:
parent
2d87fd320d
commit
23693b403c
@ -29,6 +29,12 @@ use PhpOffice\PhpWord\Writer\WriterInterface;
|
|||||||
*/
|
*/
|
||||||
class MPDF extends AbstractRenderer implements WriterInterface
|
class MPDF extends AbstractRenderer implements WriterInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Overridden to set the correct includefile, only needed for MPDF 5
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @param PhpWord $phpWord
|
||||||
|
*/
|
||||||
public function __construct(PhpWord $phpWord)
|
public function __construct(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
if (file_exists(Settings::getPdfRendererPath() . '/mpdf.php')) {
|
if (file_exists(Settings::getPdfRendererPath() . '/mpdf.php')) {
|
||||||
@ -52,13 +58,8 @@ class MPDF extends AbstractRenderer implements WriterInterface
|
|||||||
$orientation = strtoupper('portrait');
|
$orientation = strtoupper('portrait');
|
||||||
|
|
||||||
// Create PDF
|
// Create PDF
|
||||||
if ($this->includeFile != null) {
|
$mPdfClass = $this->getMPdfClassName();
|
||||||
// MPDF version 5.*
|
$pdf = new $mPdfClass();
|
||||||
$pdf = new \mpdf();
|
|
||||||
} else {
|
|
||||||
// MPDF version > 6.*
|
|
||||||
$pdf = new \Mpdf\Mpdf();
|
|
||||||
}
|
|
||||||
$pdf->_setPageSize($paperSize, $orientation);
|
$pdf->_setPageSize($paperSize, $orientation);
|
||||||
$pdf->addPage($orientation);
|
$pdf->addPage($orientation);
|
||||||
|
|
||||||
@ -78,4 +79,21 @@ class MPDF extends AbstractRenderer implements WriterInterface
|
|||||||
|
|
||||||
parent::restoreStateAfterSave($fileHandle);
|
parent::restoreStateAfterSave($fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return classname of MPDF to instantiate
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getMPdfClassName()
|
||||||
|
{
|
||||||
|
if ($this->includeFile != null) {
|
||||||
|
// MPDF version 5.*
|
||||||
|
return '\mpdf';
|
||||||
|
}
|
||||||
|
|
||||||
|
// MPDF version > 6.*
|
||||||
|
return '\Mpdf\Mpdf';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user