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.java) 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.java) 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/
