Andrew Tyson
Usenet Archive
- Joined
- Oct 18, 2002
- Messages
- 24
- Reaction score
- 0
Hi,
I am pulling my hair out trying to figure out a problem that I am having using FOP to generate PDFs that have embedded SVG graphics.
The base 64 encoded SVG is embedded as an attribute within a source XML document
<?xml version="1.0" encoding="UTF-8"?>
<ReportCashAcctStmt portfolioCode="FIXED_1" portfolioRptName="Fixed Interest testing#1" brandingImage="<svg:image width="588" height="118" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJ ...... " transform="matrix(1 0 0 1 0 0)"/>">
An XSL-T is used to generate the XSL-FO, and the SVG is embedded thus;
<fo:instream-foreign-object width="3cm" height="1cm"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg">
<svg:svg width="3cm" height="1cm" viewBox="0 0 118 558" xml:space="preserve" > <svg:g><xsl:value-of select="@brandingImage" disable-output-escaping="yes"/></svg:g></svg:svg> </fo:instream-foreign-object>
Now when I run this through Xalan command line I generate the correct XSL-FO (including the embedded image) that can be fed to FOP directly and creates a PDF, for example .
$ java org.apache.xalan.xslt.Process -IN Untitled8.xml -XSL reportClientPackFO.xsl -OUT Untitled8.fo $ java org.apache.fop.apps.Fop -fo Untitled8.fo -pdf ~/Untitled8.pdf
This works fine, however if I use FOP directly to generate the PDF using the stylesheet and source XML the image is missing !
$ java org.apache.fop.apps.Fop -xsl reportClientPackFO.xsl -xml Untitled8.xml -pdf ~/Untitled8.pdf
does not work (i.e. the image does not get embedded in the resulting PDF)
!!!
I have tried various different versions of FOP/Xerces/Xalan/Batik to no avail, and I would really appreciate any advice anyone might have.
Thanks and regards,
Andrew
I am pulling my hair out trying to figure out a problem that I am having using FOP to generate PDFs that have embedded SVG graphics.
The base 64 encoded SVG is embedded as an attribute within a source XML document
<?xml version="1.0" encoding="UTF-8"?>
<ReportCashAcctStmt portfolioCode="FIXED_1" portfolioRptName="Fixed Interest testing#1" brandingImage="<svg:image width="588" height="118" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJ ...... " transform="matrix(1 0 0 1 0 0)"/>">
An XSL-T is used to generate the XSL-FO, and the SVG is embedded thus;
<fo:instream-foreign-object width="3cm" height="1cm"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg">
<svg:svg width="3cm" height="1cm" viewBox="0 0 118 558" xml:space="preserve" > <svg:g><xsl:value-of select="@brandingImage" disable-output-escaping="yes"/></svg:g></svg:svg> </fo:instream-foreign-object>
Now when I run this through Xalan command line I generate the correct XSL-FO (including the embedded image) that can be fed to FOP directly and creates a PDF, for example .
$ java org.apache.xalan.xslt.Process -IN Untitled8.xml -XSL reportClientPackFO.xsl -OUT Untitled8.fo $ java org.apache.fop.apps.Fop -fo Untitled8.fo -pdf ~/Untitled8.pdf
This works fine, however if I use FOP directly to generate the PDF using the stylesheet and source XML the image is missing !
$ java org.apache.fop.apps.Fop -xsl reportClientPackFO.xsl -xml Untitled8.xml -pdf ~/Untitled8.pdf
does not work (i.e. the image does not get embedded in the resulting PDF)
!!!
I have tried various different versions of FOP/Xerces/Xalan/Batik to no avail, and I would really appreciate any advice anyone might have.
Thanks and regards,
Andrew