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?
-- 
View this message in context: 
http://www.nabble.com/Image.getInstance%28Image%29-sharing-problem-tf4271366.html#a12157137
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to