Hi Robert.
Robert Lummert <[EMAIL PROTECTED]> wrote on 05/10/2007 08:57:16 PM:
> I've got two problems when transforming my svg to pdf.
>
> 1. when I pass my (dynamic) svg document to the transcoder
>
> input = new TranscoderInput(ustva.document);
> transcoder.transcode(input, output);
> the document is broken afterwards.
Yes, this is because the transcoder associates a new Graphics
tree with the document breaking the association with the old tree.
Due to the construction of the SVGDom it's difficult to have one
DOM used for multiple graphics tree.
I see two potential solutions:
1) Clone the document before you transcode it, probably by
using importNode on a new SVGDocument.
2) Pass "your own" PDFGraphics2D to the paint method of the
existing Graphics Tree.
Both of these have some draw backs, #1 has the problem that
you end up with two copies of the document in memory. #2 has
the problem that the PDF Transcoder overrides some of the standard
graphics nodes to optimize the generated PDF. In particular it
replaces the standard ImageNode with one that in the case of JPEG
simply stores the compressed stream into the PDF, and in the case
of text it replaces 'simple' text with a TextNode that does a
'drawString' (rather than our normal drawGlyphVector).
> 2. I would like to have multiple pages transformed into a single pdf,
> but don't know, how.
The simplest way to do this would be to construct a FO document
that references your SVG documents. The simplest way to do that
is to write the documents to disk as temp files that the FO document
refs.
I think it would also be possible to do this in a variant of
the PDFTranscoder but I don't know the details.
Hope that helps...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]