[xep-support] Re: Output to image
Kevin Brown
kevin at renderx.com
Wed Nov 6 15:13:33 PST 2013
If the SVGs are on disk . and they contain the width/height information
inside . here's a little trick XSL .. makes a PDF that is only the SVG.
You could run all SVGs to PDF and then all PDFs to image .
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="svg:svg">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="svgimage">
<xsl:attribute name="page-width"><xsl:value-of
select="@width"/></xsl:attribute>
<xsl:attribute name="page-height"><xsl:value-of
select="@height"/></xsl:attribute>
<fo:region-body margin="0cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="svgimage">
<fo:flow flow-name="xsl-region-body">
<fo:block line-height="0">
<fo:instream-foreign-object>
<xsl:copy-of select="."/>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
From: xep-support-bounces at renderx.com
[mailto:xep-support-bounces at renderx.com] On Behalf Of Darren Munt
Sent: Wednesday, November 06, 2013 1:55 PM
To: RenderX Community Support List
Subject: [xep-support] Re: Output to image
Thanks for the replies, it was as I suspected J
In my particular case, we are producing PDFs which contain charts that are
drawn using SVG which I embed in the XSL:FO. The client now wants a 'chart
pack' which would be a zip file containing only the images in a rasterized
format so that they can be imported into other documents etc. Given that I
already have RenderX in the workflow it would be a simple matter if it could
output images. But I agree it's not really the right tool for the job.
I've found a product called Inkscape which is an SVG editor and it has a
command line utility to rasterize SVG. So I guess I will use that. It's part
of a server process so I have to shell out to run it, which I'm not a fan of
doing but looks like I have no choice.
Cheers.
!DSPAM:87,527ababc9851479422970!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.renderx.com/pipermail/xep-support/attachments/20131106/21b0c920/attachment-0001.html>
More information about the Xep-support
mailing list