54 parent::__construct($phpExcel);
63 public function save($pFilename = NULL)
65 $fileHandle = parent::prepareForSave($pFilename);
68 $paperSize =
'LETTER';
72 $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
76 $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
77 $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
79 $orientation = ($this->_phpExcel->getSheet($this->
getSheetIndex())->getPageSetup()->getOrientation()
83 $printPaperSize = $this->_phpExcel->getSheet($this->
getSheetIndex())->getPageSetup()->getPaperSize();
84 $printMargins = $this->_phpExcel->getSheet($this->
getSheetIndex())->getPageMargins();
98 if (isset(self::$_paperSizes[$printPaperSize])) {
99 $paperSize = self::$_paperSizes[$printPaperSize];
104 $pdf =
new TCPDF($orientation,
'pt', $paperSize);
105 $pdf->setFontSubsetting(FALSE);
107 $pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
108 $pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72);
110 $pdf->setPrintHeader(FALSE);
111 $pdf->setPrintFooter(FALSE);
124 $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
125 $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
126 $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
127 $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
128 $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
131 fwrite($fileHandle,
$pdf->output($pFilename,
'S'));
133 parent::restoreStateAfterSave($fileHandle);
static getPdfRendererPath()
Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use...
getOrientation()
Get Orientation.
generateHTMLHeader($pIncludeStyles=false)
Generate HTML header.
getSheetIndex()
Get sheet index.
save($pFilename=NULL)
Save PHPExcel to file.
PHP class for generating PDF documents without requiring external extensions.
const ORIENTATION_LANDSCAPE
getPaperSize()
Get Paper Size.
$pdfRendererClassFile
Require tcPDF library.
__construct(PHPExcel $phpExcel)
Create a new PHPExcel_Writer_PDF.
generateSheetData()
Generate sheet data.
generateHTMLFooter()
Generate HTML footer.