Bruno Polder wrote:

Hello Bruno,

i could give it a try, but i'm not very familiar with Graphics in Java. Do you know where i can find some examples?

It's very simple. See http://article.gmane.org/gmane.comp.java.lib.itext.general/20679
If you want the short version:
http://itextdocs.lowagie.com/tutorial/directcontent/graphics2D/
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("test.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
PdfTemplate tp = cb.createTemplate(w, h);
Graphics2D g2 = tp.createGraphics(w, h, new DefaultFontMapper());
myTextPane.paint(g2);
g2.dispose();

The difficult parts concern the font mapping
and the fact that you must not forget to invoke dispose();

See also this example:
http://itextdocs.lowagie.com/examples/com/lowagie/examples/objects/tables/alternatives/JTable2Pdf.java
br,
Bruno


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to