By Date: <-- -->
By Thread: <-- -->

Using AcroForm for form letter generation



Nick V wrote:

>I want to create the PDF output in memory by sending
>the output directly to the client via the servlet’s
>output stream. I would rather not write files on the
>server.
>
>One way I am considering doing this is by using an
>Acrobat form (AcroForm), filling it in once for each
>record pulled from the database. However, I can only
>generate one letter at a time when writing directly to
>the servlet’s output stream. I want to fill in the
>form multiple times, sending the output as one
>continuous stream. 
>
>I CAN open the Acrobat form, fill it in and save it to
>a file for each letter and then copy all the files
>into one file and send it to the user but that is not
>what I WANT to do.
>
>Does anybody know of a way to do what I have described
>using Acrobat forms?
>  
>
Today I gave a demo about a system that did just that, see:
http://itext.ugent.be/articles/ects-ict/index.php?page=4#start

What you need to do is read the empty AcroForm with PdfReader,
create a PdfStamper object that writes to a ByteArrayOutputStream,
then use the bytes returned by the toByteArray method of this outputstream
to create a new PdfReader, use this PdfReader with PdfCopy to create
the final PDF also in memory.
Iterate the reading and stamping for every record in your database.
Add every page to the PdfCopy object...

br,
Bruno

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
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions