'A4', // (210 mm by 297 mm) ); /** * Create new instance * * @param PhpWord $phpWord PhpWord object */ public function __construct(PhpWord $phpWord) { parent::__construct($phpWord); } /** * Get Font * * @return string */ public function getFont() { return $this->font; } /** * Set font. Examples: * 'arialunicid0-chinese-simplified' * 'arialunicid0-chinese-traditional' * 'arialunicid0-korean' * 'arialunicid0-japanese' * * @param string $fontName * @return self */ public function setFont($fontName) { $this->font = $fontName; return $this; } /** * Get Paper Size * * @return int */ public function getPaperSize() { return $this->paperSize; } /** * Set Paper Size * * @param int $pValue Paper size = PAPERSIZE_A4 * @return self */ public function setPaperSize($pValue = 9) { $this->paperSize = $pValue; return $this; } /** * Get Orientation * * @return string */ public function getOrientation() { return $this->orientation; } /** * Set Orientation * * @param string $pValue Page orientation ORIENTATION_DEFAULT * @return self */ public function setOrientation($pValue = 'default') { $this->orientation = $pValue; return $this; } /** * Save PhpWord to PDF file, pre-save * * @param string $pFilename Name of the file to save as * @return resource * @throws \PhpOffice\PhpWord\Exception\Exception */ protected function prepareForSave($pFilename = null) { $fileHandle = fopen($pFilename, 'w'); if ($fileHandle === false) { throw new Exception("Could not open file $pFilename for writing."); } $this->isPdf = true; return $fileHandle; } /** * Save PhpWord to PDF file, post-save * * @param resource $fileHandle * @throws Exception */ protected function restoreStateAfterSave($fileHandle) { fclose($fileHandle); } }