PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

why not change the page orientation when saving as pdf

Open daitkhealex opened this issue 8 years ago • 0 comments

I wanted to change the page orientation, and realized that it was impossible to do public function save($filename = null) { $fileHandle = parent::prepareForSave($filename); // PDF settings $paperSize = strtoupper('A4'); $orientation = strtoupper('portrait'); // Create PDF $pdf = new \mpdf(); $pdf->_setPageSize($paperSize, $orientation); $pdf->addPage($orientation); // Write document properties $phpWord = $this->getPhpWord(); $docProps = $phpWord->getDocInfo(); $pdf->setTitle($docProps->getTitle()); $pdf->setAuthor($docProps->getCreator()); $pdf->setSubject($docProps->getSubject()); $pdf->setKeywords($docProps->getKeywords()); $pdf->setCreator($docProps->getCreator()); $pdf->writeHTML($this->getContent()); // Write to file fwrite($fileHandle, $pdf->output($filename, 'S')); parent::restoreStateAfterSave($fileHandle); }


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

daitkhealex avatar Jan 21 '17 20:01 daitkhealex