27 public function save($pFilename): void
36 $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation()
38 $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize();
42 $printPaperSize = $this->spreadsheet->getSheet($this->
getSheetIndex())->getPageSetup()->getPaperSize();
59 if (isset(self::$paperSizes[$printPaperSize])) {
60 $paperSize = self::$paperSizes[$printPaperSize];
64 $config = [
'tempDir' => $this->tempDir .
'/mpdf'];
69 $pdf->AddPageByArray([
71 'margin-left' => $this->
inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getLeft()),
72 'margin-right' => $this->
inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getRight()),
73 'margin-top' => $this->
inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getTop()),
74 'margin-bottom' => $this->
inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getBottom()),
78 $pdf->SetTitle($this->spreadsheet->getProperties()->getTitle());
79 $pdf->SetAuthor($this->spreadsheet->getProperties()->getCreator());
80 $pdf->SetSubject($this->spreadsheet->getProperties()->getSubject());
81 $pdf->SetKeywords($this->spreadsheet->getProperties()->getKeywords());
82 $pdf->SetCreator($this->spreadsheet->getProperties()->getCreator());
84 $html = $this->generateHTMLAll();
85 foreach (\array_chunk(\explode(
PHP_EOL,
$html), 1000) as $lines) {
92 parent::restoreStateAfterSave();
104 return $inches * 25.4;
setOrientation($pValue)
Set Orientation.
save($pFilename)
Save Spreadsheet to file.
getSheetIndex()
Get sheet index.
getPaperSize()
Get Paper Size.
createExternalWriterInstance($config)
Gets the implementation of external PDF library that should be used.
const ORIENTATION_LANDSCAPE
getOrientation()
Get Orientation.
const ORIENTATION_PORTRAIT
const ORIENTATION_DEFAULT
inchesToMm($inches)
Convert inches to mm.