/** * Closes the document by writing the file trailer. * * While the PDF writer will remove all references to the passed in file object in itself to avoid further writing * and to allow the file pointer to be closed, the callee may still have a reference to it. If that is the case, * make sure to unset it if you don't need it. * * Any further attempts to append data to the PDF writer will result in an exception. */ public function closeDocument() { $xrefOffset = $this->writeXrefTable(); $this->writeTrailer(); $this->writeFooter($xrefOffset); $this->objectWriter->close(); }