xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Farmer" <cfar...@scitegic.com>
Subject transcoding performance question
Date Sat, 01 May 2004 00:41:08 GMT

I am currently using batik to render some simple SVG documents into a
larger PDF document.  The code for this step was modified from code I
found on the iText mailing list:

PrintTranscoder prm = new PrintTranscoder();
prm.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, new
prm.addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, new
TranscoderInput ti = new TranscoderInput(document);
prm.transcode(ti, null);
Paper paper = new Paper();
paper.setSize(width, height);
paper.setImageableArea(0, 0, width, height);
PageFormat page = new PageFormat();
prm.print(graphics2d, page, 0);

I basically just want to draw the SVG content to the graphics2d, which
is am iText PDFGraphics2D object.  This works nicely.  

Here's the problem:  I am doing this in a relatively high-volume way.  I
could potentially have several hundred to several thousand small and
simple (~1kb - 5kb) SVG documents that I need to draw to PDF.  I have
found that the performance is acceptable when there is little or no text
in the SVG, but the performance falls off rapidly as the number of SVG
text elements increases.  At the extreme, a single SVG document can take
nearly half a second to be drawn on the PDF.  This makes the whole
process typically very slow.  I'm looking for suggestions for how I
might be able to speed this up.

I saw on the fop web site some info that led me to believe that I might
be able to improve things a bit:

This implies that there are rendering hints I can apply to get fop/batik
to render text in a more efficient but less flexible way.  (I'm happy
with less flexibility.)  I can't seem to figure out how to integrate
this with my current app, though.  The fop PDFTranscoder seems to have
some promise, but if I use the fop PDFTranscoder like so:

org.apache.fop.svg.PDFTranscoder pdft = new
pdft.addTranscodingHint(PDFTranscoder.KEY_STROKE_TEXT, new

...I don't see how I can use this to draw to my graphics2d.  Can someone
help with this?  Is this kind of approach likely to help my performance


To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

View raw message