Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Image.getInstance(Image) sharing problem

Karnok Dávid (T)

2007-08-15



Hello.
I generate a lot of PDF files from database and I noticed that the first
generated PDF was OK, but the others where blank - but in correct filesize.
I reduced the problem to the Image.getInstance(Image). For example:
public static main(String[] args] {
 BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1250,
true);
 Image img = Image.getInstance("./doc/image.wmf");
 Font f = new Font(bf, 12, Font.BOLD);
 Document doc = new Document(PageSize.A4);
 PdfWriter writer = PdfWriter.getInstance(doc, new
FileOutputStream("1.pdf"));
 doc.open();
 doc.add(new Paragraph("Hello world", f));
 doc.add(Image.getInstance(img));
 doc.close();

 doc = new Document(PageSize.A4);
 writer = PdfWriter.getInstance(doc, new FileOutputStream("2.pdf"));
 doc.open();
 doc.add(new Paragraph("Hello world", f));
 doc.add(Image.getInstance(img));
 doc.close();
}
The img is preloaded and added to each new document via that method. Do I
something wrong?
--
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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/
©2008 junlu.com - Jax Systems, LLC, U.S.A.