Recently, I created an output template for the Print module, such that it dynamically generates a measurement sheet when a certain content type is parsed by its PDF functionality (using dompdf in this case).
Everything works great, but the client’s requested file attachment fields for PDFs, such that existing PDFs are added to the end of dompdf’s output. For instance, a PDF of a CAD drawing would be attached in Drupal, printpdf/$nid generates the template I’ve created, and the file locations given from the file upload fields are used to merge the files at those locations with the generated PDF.
dompdf apparently cannot merge PDF documents, so I’m thinking a workaround would be to generate the PDF and save to disk somewhere, run another PDF merger script, then present the merged output to the user.
How would one go about programmatically saving the output of Print.module’s PDF generator to somewhere on the server, then running an external class on that saved output?
(Alternately, if you know of a way for dompdf to read PDFs and append them to the document, that’d work even better.)