On Tue, 19 Jun 2001 Keiron Liddle answered:

>> Can org.apache.fop.svg.PDFDocumentGraphics2D be used in a way similar to
>> org.apache.batik.svggen.SVGGraphics2D?
>> (I hope someone has got the urge to provide me with an example before I
>> start to play with it.)
> If I understand your question, yes you can use it in a similar way.
> Depending on what you want to do it may be best to use the PDFTranscoder,
> as it does a few extra things.

What I had in mind, was a shortcut on the way from Graphics 2D to PDF.
Up to that moment, I had used SVGGraphics2D to create SVG 
and FOP to turn this SVG into PDF.
For a simple sample scene this transformation took 520 seconds with FOP
FOP 0.19 gave a boost to only 12 seconds.
And it's mere 2,5 seconds if I paint to PDFDocumentGraphics2D directly.

I simply snatched a few lines from your PDFTranscoder:

   PDFDocumentGraphics2D pdfGenerator =
      new PDFDocumentGraphics2D(true, stream, width, height);
   pdfGenerator.setSVGDimension(w, h);
   GraphicsNodeRenderContext rc = getRenderContext();
      new org.apache.batik.ext.awt.g2d.GraphicContext());
   // Ask the component to render into the PDF Graphics2D implementation.
   ((Graphics2D)pdfGenerator).setClip(0, 0, width, height);
   component.export((Graphics2D)pdfGenerator, pageFormat, false);

I'll have to tune it a bit,
and I don't quite understand everything yet that's happening behind the
but the PDFDocumentGraphics2D is great.

I wonder, why the PDFTranscoder can do without a call to setClip.
If I don't add this line in my code, there's a NullPointerException in

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to