Martin Weiss wrote:
> Hi all iText cracks,
> the following code snippet throws an IOException (no pages) when closing the
> document. The PdfWriter.getImportedPage() method is invoked several times...
> Any idea what causes the problem.
You create an object of type PdfImportedPage,
but you never add it to the document.
See my changes below:
> document.open();
> PdfReader reader = new PdfReader(byteArrayOutputStream.toByteArray());
> int total = reader.getNumberOfPages();
> for (int i = 1; i <= total; i++) {
PdfImportedPage page = writer.getImportedPage(reader, i);
writer.getDirectContentUnder().addTemplate(page, 0, 0);
> }
> document.close();
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
>
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/