|
Hi, I am posting this question to both the Batik group and the
FOP group - not sure who might be able to help me. I am running into a problem when trying to transcode SVG content to PDF. I have quite a large SVG document which is created using JGraph. It usually has a width of 1100 pixels and a height of 1600
pixels. When viewed as SVG everything is great. I then use the PDFTranscoder to
create a PDF document. The problem is that it is "clipped" - I see only a
small segment of the document in teh top left corner. I have tried in vain to get the entire document converted. Any help would be greatly appreciated. Here is how things are created in my code: The SVG is created by using a JGraph
object and then painting onto an SVG canvas: DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; Document document = domImpl.createDocument(svgNS, "svg",
null); SVGGraphics2D
svgGenerator = new SVGGraphics2D(document); aGraph.paint(svgGenerator); Then I dump it into a file which is used to generate the PDF
output: (The transcoder is PDFTranscoder) XMLAbstractTranscoder t = (XMLAbstractTranscoder)((Class)transcoderMap.get(contentType)).newInstance(); java.awt.Rectangle aoi = new java.awt.Rectangle(0, 0,
(new Double(dim.getWidth())).intValue(),
(new Double(dim.getHeight())).intValue()); t.addTranscodingHint(SVGAbstractTranscoder.KEY_AOI, aoi); t.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_WIDTH,
new Float(dim.getWidth())); t.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_HEIGHT,
new Float(dim.getHeight())); TranscoderInput input = new TranscoderInput(svgURI); TranscoderOutput output = new TranscoderOutput(pdfStream); t.transcode(input,
output); I tried with and without hints, with and without height and
width in the SCG doc, tried to play with pixel
to MM mapping (which doesn't seem to do anything as far as I can see) and all kinds of other
attempts but I have reached the point that because I don't understand what is doing the
clipping, it is all voodoo for me at this point. By the way - if I can get a PDF document with multiple pages
in it that would be even better!! Thanks for the help, -Ron |
- Re: How to get ALL parts of a large SVG document in a sing... Ron Ben-Natan
- Re: How to get ALL parts of a large SVG document in a... Jeremias Maerki
- Re: How to get ALL parts of a large SVG document in a... Peter Menzel
