Problem with adding a JFreeChart into a PDF document

G

Grand Paradis

I would like to add a JFreeChart into a PDF document, using jfreechart
and itext libraries, but my chart isn't clean. When I add it into an
HTML page, it's beautiful, but into a PDF it's very ugly (text of
title and categories is too big and not thin enough)

Here is my code :

private void writeChart (JFreeChart chart, int width, int height,
PdfContentByte cb) {

PdfTemplate tp = cb.createTemplate(width, height);
Graphics2D g2 = tp.createGraphics(width, height, new
DefaultFontMapper());
Rectangle2D r2 = new Rectangle2D.Double(0, 0, width, height);
chart.draw(g2, r2);
g2.dispose();
cb.addTemplate(tp, 100, 550);
}

Do you know what I should do?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top