Allow to redefine TCPDF object
Sometimes we need create TCPDF object with modified initial arguments. This change allow rewrite only createExternalWriterInstance() in user defined TCPDF class.
This commit is contained in:
parent
21f4bb3053
commit
d6260988bd
|
|
@ -36,6 +36,20 @@ class TCPDF extends AbstractRenderer implements WriterInterface
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
|
@ -50,7 +64,7 @@ class TCPDF extends AbstractRenderer implements WriterInterface
|
|||
$orientation = 'P';
|
||||
|
||||
// Create PDF
|
||||
$pdf = new \TCPDF($orientation, 'pt', $paperSize);
|
||||
$pdf = $this->createExternalWriterInstance($orientation, 'pt', $paperSize);
|
||||
$pdf->setFontSubsetting(false);
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue