Use PdfWriter.releaseTemplate(). Use this method to release the memory used by
a template. This method writes the template to the output. The template can
still be added to any content but changes to the template itself won't have any
effect.
Paulo
> -----Original Message-----
> From: Pradeep Kumar Badam [mailto:pradeep.ba...@aptuit.com]
> Sent: Tuesday, March 24, 2009 6:06 AM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] OutOfMemoryError when PdfTemplate is used
>
> Hi,
>
>
>
> My requirement is to create a PDF using iText 2.1.2 which
> would contain more than 30,000 pages.
>
>
>
> My application writes data (Text, Rectangle, images etc.) to
> Graphics2D object.
>
>
>
> I have created Graphics2D object by using the following:
>
>
>
> PdfTemplate pdfTemplate =
> pdfContentByte.createTemplate(width, height);
>
> Graphics2D g2 = pdfTemplate.createGraphicsShapes(width, height);
>
>
>
> This code runs well up to 1000 pages and gets "Exception in
> thread "main" java.lang.OutOfMemoryError: Java heap space"
> for more number of pages.
>
> I have increased Java heap size to 512Mb. Works fine up to
> 5000 pages and again same error.
>
>
>
> If I create Graphics2D object from PdfContentByte using the following:
>
> Graphics2D g2 = pdfContentByte.createGraphicsShapes(width, height);
>
> This code works fine for more than 30,000 pages.
>
>
>
>
>
> I have to use pdfTemplate for the following reasons:
>
>
>
> 1. Some data in each page would be repeated, so that time to
> create the PDF and size of the PDF can be reduced with this.
>
> 2. I have to create some PDFs with pages at 90 degree
> rotation which can be done by adding pdfTemplate to pdfContentByte.
>
>
>
>
>
> So please suggest me creating PDF (which would contain more
> than 30,000 pages) using pdfTemplate.
>
>
>
>
>
> Thanks & Regards
>
> Pradeep Kumar B
> Sr. Software Engineer, Java Team
>
> Aptuit Informatics <http://www.aptuitinformatics.com/>
>
> Division of Aptuit Laurus Pvt. Ltd.
>
> Plot No. 100-101
> Export Promotion Industrial Park
> Whitefield, Bangalore 560 066 India
>
>
> +91 80 4190 7800 (office)
>
> +91 80 4190 7907 (Direct)
>
> +91 80 4190 7805 Fax
>
> www.Aptuit.com <blocked::http://www.aptuit.com/>
> pradeep.ba...@aptuit.com <blocked::mailto:sumit.ran...@aptuit.com>
>
>
>
>
>
> This email and any files transmitted with it are confidential
> and intended
> solely for the use of the individual or entity to whom they
> are addressed.
> If you have received this email in error please notify the
> sender by email
> reply and delete it from your system.
> The integrity and security of this email cannot be guaranteed
> on the Internet.
>
>
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php