On 07/25/2012 06:14 AM, Haimerl, Josef wrote:
Hello,
right now I'm trying to modify the pdf-export for adding attached pdf-files to the end of the export like the existing functionality for adding attached images.
Starting from the beginning with the pdf.vm I couldn't find an analogy to include the pdf-files in the way of image-files, because as I see it the images just get rendered as html.
Can anybody give me a hint how to proceed to solve this task?
Hm, that's a very difficult topic... I don't think it's possible out of the box, but here are some ideas: Apache FOP, the tool we use for generating PDFs, doesn't support embedding external PDF documents in the output by default, but there is a FOP extension that adds support for this: http://www.jeremias-maerki.ch/development/fop/index.html This extension provides support for: <fox:external-document src="my-doc.pdf"/> This means that you would have to change the way we generate the FO document by: - adding <img src="$doc.getAttachmentURL('file.pdf')"/> in pdf.vm - changing the way img tags are processed in xhtml2fo.xsl so that it generates fox:external-document instead of fo:external-graphic if the image ends with .pdf Another option is to post-process the PDF generated so that you combine it with the attached PDF files using pdfbox, but that would require some Java code to extend the PDFExportImpl class to add this behavior. -- Sergiu Dumitriu http://purl.org/net/sergiu/