mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-17 13:36:49 +00:00
Pdf Writer strtoupper() fix (#1629)
* _setPageSize's strtoupper() on array argument PhpSpreadsheet/Writer/Pdf.php Class defines a protected static mixed array called $paperSizes, this array contains string values along with array values. 'strtoupper() expects parameter 1 to be string, array given' error happens due to array passed to $paperSize variable from that $paperSizes mixed array on the Mpdf Class where Pdf extends Examples of cases, when a 'Letter' paper size is chosen, then no problem occurs since the index in that value for the array is a string value, but when 'Tabloid' paper size is chosen the value in the index for that paper size is an array, that's when the strtoupper() error happens * _setPageSize's strtoupper() on array argument PhpSpreadsheet/Writer/Pdf.php Class defines a protected static mixed array called $paperSizes, this array contains string values along with array values. 'strtoupper() expects parameter 1 to be string, array given' error happens due to array passed to $paperSize variable from that $paperSizes mixed array on the Dompdf Class where Pdf extends Examples of cases; when a 'Letter' paper size is chosen, then no problem occurs since the index in the array for that value a string, but when 'Tabloid' paper size is chosen the value in the index for that paper size is an array, that's when the strtoupper() error happens.
This commit is contained in:
@@ -59,7 +59,7 @@ class Dompdf extends Pdf
|
||||
|
||||
// Create PDF
|
||||
$pdf = $this->createExternalWriterInstance();
|
||||
$pdf->setPaper(strtolower($paperSize), $orientation);
|
||||
$pdf->setPaper($paperSize, $orientation);
|
||||
|
||||
$pdf->loadHtml($this->generateHTMLAll());
|
||||
$pdf->render();
|
||||
|
||||
@@ -64,7 +64,7 @@ class Mpdf extends Pdf
|
||||
$config = ['tempDir' => $this->tempDir . '/mpdf'];
|
||||
$pdf = $this->createExternalWriterInstance($config);
|
||||
$ortmp = $orientation;
|
||||
$pdf->_setPageSize(strtoupper($paperSize), $ortmp);
|
||||
$pdf->_setPageSize($paperSize, $ortmp);
|
||||
$pdf->DefOrientation = $orientation;
|
||||
$pdf->AddPageByArray([
|
||||
'orientation' => $orientation,
|
||||
|
||||
Reference in New Issue
Block a user