[xep-support] Re: Output to image

From: Darren Munt <darrenm@ardex.com.au>
Date: Wed Nov 06 2013 - 15:21:12 PST

Thanks Kevin, I will have a play with that.

From: xep-support-bounces@renderx.com [mailto:xep-support-bounces@renderx.com] On Behalf Of Kevin Brown
Sent: Thursday, 7 November 2013 10:14 AM
To: 'RenderX Community Support List'
Subject: [xep-support] Re: Output to image

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@renderx.com<mailto:xep-support-bounces@renderx.com> [mailto:xep-support-bounces@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 :)

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,527acef19851916636237!

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Wed Nov 6 15:21:31 2013

This archive was generated by hypermail 2.1.8 : Wed Nov 06 2013 - 15:21:55 PST