Must the Chart stay Vector in the finished PDF?
If not, you can get the BufferedImage from JFreeChart using:
BufferedImage image = chart.createBufferedImage(width, height);
and add that to the PDF instead.
-Bill Ensley
www.bearprinting.com
On 4/12/2011 11:36 AM, Mark Storer wrote:
I'm going to guess that this chart is rendered as a number of vertical
lines rather than as a bitmap in its own right. So my best guess:
Rounding Errors.
Do the lines appear in the same places at different zoom settings, or
do they move around (or even vanish) depending on the current zoom?
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
------------------------------------------------------------------------
*From:* Raunak Kathuria [mailto:[email protected]]
*Sent:* Sunday, April 10, 2011 10:00 PM
*To:* [email protected]
*Subject:* [iText-questions] JFreeChart and IText integration problem
Hi
I have a stacked multiple area chart that I am generating through
JFreeChart as attached below
but when i print it to pdf using itext then it render as image
attached below:
The code that I have used is
////////////////////////////////////////////////////////////////////
// creating chart object
JFreeChart chart =
ChartGeneratorService.generateChart(chartConfig);
if(ReportsConstants.CHART_TYPE_STACKED_AREA !=
chartConfig.getChartType()){
addEmptyLine(document, 3);
}
// get the direct pdf content
PdfContentByte dc =
writer.getDirectContent();
int width =
ReportsConstants.CHART_DEFAULT_WIDTH;
int height =
ReportsConstants.CHART_DEFAULT_HEIGHT;
// get a pdf template from the direct content
PdfTemplate tp = dc.createTemplate(width,
height);
// create an AWT renderer from the pdf
template
Graphics2D g2 = tp.createGraphics(width,
height);
Rectangle2D r2D = new
Rectangle2D.Double(0,0, width,height);
chart.draw(g2,r2D);
g2.dispose();
Image image = Image.getInstance(tp);
image.setAlignment(Image.ALIGN_CENTER);
document.add(image);
/////////////////////////////////////////////////////////////
Any idea why it is rendered as shown, any help would be appreciated.
Thanks & Regards
Raunak Kathuria
*Raunak Kathuria
Aon Hewitt* | India Technology Group
UniTech World | Gurgaon, Sector - 39
m +91-9910874433_
[email protected]_
<mailto:[email protected]> | aonhewitt.com
<http://aonhewitt.com/>
------------------------------------------------------------------------
The information contained in this e-mail and any accompanying
documents may contain information that is confidential or
otherwise protected from disclosure. If you are not the intended
recipient of this message, or if this message has been addressed
to you in error, please immediately alert the sender by reply
e-mail and then delete this message, including any attachments.
Any dissemination, distribution or other use of the contents of
this message by anyone other than the intended recipient is
strictly prohibited. All messages sent to and from this e-mail
address may be monitored as permitted by applicable law and
regulations to ensure compliance with our internal policies and to
protect our business. E-mails are not secure and cannot be
guaranteed to be error free as they can be intercepted, amended,
lost or destroyed, or contain viruses. You are deemed to have
accepted these risks if you communicate with us by e-mail.
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php