After adding the page call copy.freeReader(). You can also speed up things with:

PdfReader original = new PdfReader("EIDFormTemplate.pdf");
...
...
reader = new PdfReader(original);

Another speed increase can be done with AcroFields.setFieldCache(). There's an 
example in the javadocs and it's all explained in more detail in the book.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of "Strüßmann, Mirko \(KRZ\)"
> Sent: Wednesday, November 22, 2006 5:10 PM
> To: [email protected]
> Subject: [iText-questions] How to generate mass mailings from 
> a template PDF
> 
> Hi all,
>  
> I have a data file (CSV) and a PDF form template with it's 
> fields named like the columns within the data file. I now 
> want to create a PDF file with one page for every data row. 
> So every page of the created PDF file should consist of the 
> PDF form with the values from CSV file filled in the form fields.
> 
> I've found two possible solutions on 
> http://itext.ugent.be/articles/eid-pdf/index.php.
> 
> The first 
> (http://itext.ugent.be/articles/eid-pdf/test/EIDFormTemplate.j
> ava) does use a PdfCopy and a PdfStamper to fill the form 
> fields of the PDF form template and then add the filled in 
> document to the PdfCopy. The drawback of this solution is 
> that it is very slow, it uses a lot of memory and it creates 
> real huge PDF files. In fact using it with only 7000 data 
> rows and "-Xmx1024m" lead to an OutOfMemoryError. (And in 
> production we are talking about more than 100,000 data rows.)
> 
> The second 
> (http://itext.ugent.be/articles/eid-pdf/test/BatchFormFill.jav
> a) possible solution is to extract the fields coordinates 
> from the PDF and then to simply add the form as a template to 
> the getDirectContentUnder() and in the second step to draw 
> the data values to the coordinates of the form fields. This 
> is very fast, produces very small PDF files and uses a lot 
> less memory than the first solution. The drawback is that the 
> values does not automatically use the font that the designer 
> of the PDF form template defined for the corresponding form field.
> 
> Is there any other way that I can take to get an acceptable 
> solution? Is it possible to improve the performance of the 
> first solution (which is the nicer one in my eyes)? How can I 
> retrieve the font used within a form field in order to use 
> that font in the second solution?
> 
> Thank you for any answer!
> 
> - Mirko Strüßmann -
> 
> --------------------------------------------------------------
> -----------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the 
> chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
> &CID=DEVDEV
> _______________________________________________
> 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/
> 


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.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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