Make sure you call dispose().
Paulo
----- Original Message -----
From: "victor73" <victor73@(protected)>
To: <itext-questions@(protected)>
Sent: Monday, August 13, 2007 6:21 PM
Subject: [iText-questions] Error when stamping a JFreeChart wrapped as
animage
>
> Hi all!
>
> I'm trying to add a JFree pie chart to a pdf using the PdfStamper class
> without having to save the chart as an image file first. The code runs
> without errors, but when I try to open the resulting output pdf, I get the
> following error from Acrobat Reader (versions 7 & 8):
>
> "There was an error processing a page. There was a problem reading this
> document (18)."
>
> I can get it to work by first saving the chart as a .png then loading it
> and
> inserting it with the PdfStamper, but I'd rather not do it that way so I
> don't have to worry about print resolution issues... Here is a simplified
> code snippet of what I'm doing:
>
>
> public void stamp(PdfTemplate chartTemplate) {
> PdfReader reader = new PdfReader("/path/to/template.pdf");
> PdfStamper stamper = new PdfStamper(reader,
> new FileOutputStream("/path/to/output.pdf"));
>
> PdfContentByte over = stamper.getOverContent(1);
>
> Image image = Image.getInstance(chartTemplate);
>
> image.scaleAbsolute(216, 216);
> image.setAbsolutePosition(20, 80);
> over.addImage(image);
>
> stamper.close();
> }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/