I am suffering with the issue of getting a local .pdf into my rendered PDF. I currently have a template for a picture where i can easily load images into my PDF.
<!-- Picture -->
<xsl:template match="picture">
<fo:block text-align="left">
<fo:external-graphic src="url('file:///C:/Images/testImage.jpeg')" content-height="5cm" />
</fo:block>
</xsl:template>
I wonder if it is possible to get this done on the same way for a PDF. Currently i am unsuccessfully trying to use
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
so what i have done looks like this:
<!-- Chart which is saved as PDF-->
<xsl:template match="chart">
<fo:block text-align="left">
<fox:external-document content-type="pdf" src="url('file:///C:/Pdfs/ExampleChart.pdf')"/>
</fo:block>
</xsl:template>
I am using FOP 2.3 and the Error i get is
org.apache.fop.fo.flow.Block cannot be cast to org.apache.fop.fo.pagination.Root
So what i expect is that i cant use fox:external-document there but thats exatly the place where i need the PDF to be.
Thanks for your help!!!
Ok I think i just luckily found the solution i was looking for on my own! i Just added the jar files from: HERE to the lib directory of the FOP folder. Then i was able to embedd the PDF like so:
<!-- Chart -->
<xsl:template match="chart">
<fo:block text-align="left">
<fo:external-graphic src="url('file:///C:/Pdfs/ExampleChart.pdf')"/>
</fo:block>
</xsl:template>
Hope this will help anyone who is suffering on the same problem :)