Hi Bruno,
As you said in the previous thread (Abhishek's):
"There are other ways to do it, and the book will give you
another example using setField and setFieldCache, but
the procedure described above is faster because it cuts
a lot of corners.
best regards,
Bruno"
I am exactly doing the same, I followed all your steps. Can you suggest me
how to use setField and setFieldCache for setting AcroForm fields over
multiple pages. If you can give me an example code, that will be great for
me.
Thanks in advance,
Ganesh.
Bruno Lowagie wrote:
>
> As promised, this is the procedure I use to create a 27.000+ page document
> really fast using an existing 1-page PDF document with a form.
>
> My class Letter extends PdfPageEventHelper.
>
> In the onOpenDocument method
> 1. I read the existing PDF and retrieve the fields and their coordinates
> I store these coordinates for later use.
> 2. I read the page into a PdfImportedPage and store this page in a
> member variable 'page'
>
> In the onStartPage method, I do:
> writer.getDirectContent().addTemplate(page, 0, 0);
>
> In the main method, I go through the 5 steps of document creation:
> 1. Document document = new Document();
> (in your case, it would probably be a good idea to retrieve the page
> size from the original PDF)
> 2. PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("new.pdf"));
> Letter letter = new Letter();
> writer.setPageEvent(letter);
> 3. document.open();
> 4. I add content
> I loop over all the records in my database and I add it to the PDF
> using ColumnText
> the coordinates used in the ColumnText objects, are the ones retrieved
> in the onOpenDocument method.
> After each record, I do document.newPage();
> I don't worry about the 'template', the imported page is added
> automatically in the page event.
> 5. document.close();
>
> There are other ways to do it, and the book will give you
> another example using setField and setFieldCache, but
> the procedure described above is faster because it cuts
> a lot of corners.
>
> best regards,
> Bruno
>
> -------------------------------------------------------------------------
> 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
>
>
--
View this message in context:
http://www.nabble.com/Generation-of-Multiple-Page-PDF-Document-is-slow-tf2050222.html#a5938660
Sent from the iText - General forum at Nabble.com.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions