diff --git a/Classes/PHPExcel/Writer/PDF.php b/Classes/PHPExcel/Writer/PDF.php index bacfe90a..49ac5fc0 100644 --- a/Classes/PHPExcel/Writer/PDF.php +++ b/Classes/PHPExcel/Writer/PDF.php @@ -245,9 +245,11 @@ class PHPExcel_Writer_PDF extends PHPExcel_Writer_HTML implements PHPExcel_Write if (is_null($this->getSheetIndex())) { $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); } // Override Page Orientation @@ -267,8 +269,15 @@ class PHPExcel_Writer_PDF extends PHPExcel_Writer_HTML implements PHPExcel_Write // Create PDF $pdf = new TCPDF($orientation, 'pt', $paperSize); + // Set margins, converting inches to points (using 72 dpi) + $pdf->SetMargins($printMargins->getLeft() * 72,$printMargins->getTop() * 72,$printMargins->getRight() * 72); + $pdf->SetAutoPageBreak(true,$printMargins->getBottom() * 72); +// $pdf->setHeaderMargin($printMargins->getHeader() * 72); +// $pdf->setFooterMargin($printMargins->getFooter() * 72); + $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); + $pdf->AddPage(); // Set the appropriate font diff --git a/changelog.txt b/changelog.txt index 65659539..8f708109 100644 --- a/changelog.txt +++ b/changelog.txt @@ -32,6 +32,7 @@ Fixed in SVN: - Feature: (MBaker) Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML - Feature: (MBaker) Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean - Feature: (MBaker) Work item 14301 - PHPExcel_Worksheet->toArray() is returning truncated values +- Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Percent - Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant