Reputation: 33
I am using Apache Camel + Apache FOP to convert an XML to PDF with using XSL, the project is build with Maven + Java 8
When I try to insert a logo image in the footer of my PDF but I get this error:
"src" attribute is not allowed on the fo:external-graphic element!
<fo:table-cell>
<xsl:attribute name="text-align">left</xsl:attribute>
<fo:block>
<fo:external-graphic src="url(file:///home/someDir/resources/Logo.jpg)" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
Upvotes: 0
Views: 749
Reputation: 8857
Or ... simply in your original example:
<fo:external-graphic src="url('file:///home/someDir/resources/Logo.jpg')" />
The function url() takes a string. You are not passing it a string as you have not enclosed it in quotes. This is (in reality) all you accomplished by using <xsl:attribute>
in your solution.
Upvotes: 2
Reputation: 33
I've found the solution that works
<fo:block>
<fo:inline>
<fo:external-graphic>
<xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
<xsl:attribute name="content-height">200%</xsl:attribute>
<xsl:attribute name="width">200%</xsl:attribute>
<xsl:attribute name="scaling">uniform</xsl:attribute>
<xsl:attribute name="src">url('file:///home/someDir/resources/Logo.jpg')</xsl:attribute>
</fo:external-graphic>
</fo:inline>
</fo:block>
Upvotes: 0