createExternalWriterInstance($orientation, 'pt', $paperSize); $pdf->setFontSubsetting(false); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); $pdf->SetFont($this->getFont()); $pdf->writeHTML($this->getContent()); // 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()); // Write to file fwrite($fileHandle, $pdf->Output($filename, 'S')); parent::restoreStateAfterSave($fileHandle); } }