JFreeChart Image and Itext 7

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

JFreeChart Image and Itext 7

Postby 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);
gw1500se
 
Posts: 13
Joined: Tue Nov 21, 2017 3:36 pm

Re: JFreeChart Image and Itext 7

Postby 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.
paradoxoff
 
Posts: 1619
Joined: Sat Feb 17, 2007 1:51 pm

Re: JFreeChart Image and Itext 7

Postby 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.
gw1500se
 
Posts: 13
Joined: Tue Nov 21, 2017 3:36 pm

Re: JFreeChart Image and Itext 7

Postby 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.
paradoxoff
 
Posts: 1619
Joined: Sat Feb 17, 2007 1:51 pm


Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 12 guests