Merge pull request #1907 from SailorMax/patch-2

Allow to redefine TCPDF object
This commit is contained in:
troosan 2020-12-29 23:19:47 +01:00 committed by GitHub
commit e3732ef610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -36,6 +36,20 @@ class TCPDF extends AbstractRenderer implements WriterInterface
*/ */
protected $includeFile = 'tcpdf.php'; protected $includeFile = 'tcpdf.php';
/**
* Gets the implementation of external PDF library that should be used.
*
* @param string $orientation Page orientation
* @param string $unit Unit measure
* @param string $paperSize Paper size
*
* @return \TCPDF implementation
*/
protected function createExternalWriterInstance($orientation, $unit, $paperSize)
{
return new \TCPDF($orientation, $unit, $paperSize);
}
/** /**
* Save PhpWord to file. * Save PhpWord to file.
* *
@ -50,7 +64,7 @@ class TCPDF extends AbstractRenderer implements WriterInterface
$orientation = 'P'; $orientation = 'P';
// Create PDF // Create PDF
$pdf = new \TCPDF($orientation, 'pt', $paperSize); $pdf = $this->createExternalWriterInstance($orientation, 'pt', $paperSize);
$pdf->setFontSubsetting(false); $pdf->setFontSubsetting(false);
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); $pdf->setPrintFooter(false);