A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
gw1500se
- Posts: 23
- Joined: Tue Nov 21, 2017 3:36 pm
- antibot: No, of course not.
Post
by gw1500se » Thu Nov 30, 2017 5:00 pm
I am migrating my app from Itext 5 to Itext 7. However, I can only find examples of images for Itext 5. Can someone tell me how to change this to Itext 7?
Code: Select all
PdfContentByte cb=writer.getDirectContent();
PdfTemplate tp=cb.createTemplate(sizeX*scale+1,sizeY*scale+1);
PdfGraphics2D g2d=new PdfGraphics2D(cb,sizeX*scale+1,sizeY*scale+1);
tp.setWidth(sizeX*scale+1);
tp.setHeight(sizeY*scale+1);
Chart.getInstance().getChart().draw(g2d, new java.awt.geom.Rectangle2D.Float(0,0,sizeX*scale,sizeY*scale));
g2d.dispose();
cb.add(tp);
-
paradoxoff
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Post
by paradoxoff » Thu Nov 30, 2017 10:42 pm
itext has undergone a complete API change between version 5 and 7. I suggest to contact itext directly.
-
gw1500se
- Posts: 23
- Joined: Tue Nov 21, 2017 3:36 pm
- antibot: No, of course not.
Post
by gw1500se » Fri Dec 01, 2017 1:01 pm
Thanks for the reply. I was concerned that if I throw JFreeChart in to the mix they would send me here. I'll give it a try.
-
paradoxoff
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Post
by paradoxoff » Fri Dec 01, 2017 4:41 pm
Your question is independent on JFreeChart. It it is about replacements for PdfGraphcis2D, and PdfContentByte, and in more general sense about how to integrate instance of java.awt.Image into a PDF.