Hello.

I have a graph as SVG and want to save it as a PDF file using itext.
The graph is rather large so I don't want to convert the graph into
bitmap graphics.

Has anyone hints how to achieve this?
I have tried the code Paulo Soares mentioned in
http://sourceforge.net/mailarchive/message.php?msg_id=6886596

This does however does not maintain the text and vector characteristics
(at least here with me). On my computer (Linux, Java 1.4, batik 1.6,
itext 1.4) the svg graph is converted into a bitmap and embedded in the
pdf file.

Here is the code fragment I use:

<code>
  PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(pdfFile));
  document.open();

  PdfContentByte cb = writer.getDirectContent();
  Graphics2D g2 = cb.createGraphics(500, 500);
  PrintTranscoder prm = new PrintTranscoder();
  TranscoderInput ti = new TranscoderInput(graphSvgURL);
  prm.transcode(ti, null);
  PageFormat pg = new PageFormat();
  Paper pp= new Paper();
  pp.setSize(500, 500);
  pp.setImageableArea(0, 0, 500, 500);
  pg.setPaper(pp);
  prm.print(g2, pg, 0);
  g2.dispose();

  document.close();
</code>

Any hints?


Greetings,

Joern

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to