Mathias Kalb wrote:

Hello,

I use the PDFTranscoder to create a PDF document from SVG, but
the quality of the result is bad.
I tried it with the pdftranscoder.jar from Batik 1.5/1.5.1 and with
the fop.jar (FOP 0.20.5) and the results were different.

Yes, Batik ships with a newer version of the PDF transcoder files.


pdftranscoder:
-the colors are a little different

I have not seen this, can you provide sample content?


-the text has no anti-aliasing

This depends on how you have your PDF viewer setup, by default Acrobat doesn't anti-alias text, you can tell it you want it to (Preferences somewhere). I don't think there is currently an option to always output text as paths.

-the opacity seems to be okay

fop:
-the colors are okay
-the opacity does not work
-the text has anti-aliasing


How can I create a pdf document wich looks like the original SVG? The created JPG, PNG and TIFF documents are correct.

It's usually the wrong thing to do but you could just embed a JPEG/PNG in the PDF. The simplest way to do this would be to create a 'small' SVG that consisted just of an image element that referenced the rasterized PNG. Of course when you went to print it the result would probably look a bit blurry.

public static void transcodeSVG2PDF(byte[] svgInput,
                                    OutputStream output,
                                    Color backgroundColor)
                           throws TranscoderException, IOException {
 TranscoderOutput transcoderOutput = new TranscoderOutput(output);
 PDFTranscoder transcoder = new PDFTranscoder();
 transcoder.addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR,
                               backgroundColor);
 transcoder.transcode(new TranscoderInput(
                                 new ByteArrayInputStream(svgInput)),
                      transcoderOutput);
 output.flush();
}


Thanks! Mathias Kalb




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



Reply via email to