I have a pdf form which  i prepopulate with data then email it. But the form
fields dont seem to be in the new pdf the fields are filled out with the
data but I cant access them when i try to get the fields from the new pdf
the AcroFields.getFields() is empty.


This is the loop where everything happens

        for (Organization theOrganization : organizations){

                if(env.equals("prod"))
                    localToAddress =
theOrganization.getUpdateContactPersonEmai();
                else
                    localToAddress = toAddress;

                Document document = new Document();

                ByteArrayOutputStream theNewFile =  new
ByteArrayOutputStream();

                PdfCopy copy = new PdfCopy(document, theNewFile);

                document.open();
                PdfReader reader = new
PdfReader(formDirectory+"/"+pdfFormName);


                ByteArrayOutputStream baos = new ByteArrayOutputStream();


                PdfStamper stamper = new PdfStamper(reader, baos);
                AcroFields formFields = stamper.getAcroFields();

                // get the contacts for this organization
                List<Contact> contacts =
contactDao.searchContactForOrg(theOrganization.getId());

                //fill the pdf's organization info fields
                fillOrg(formFields, theOrganization);
                // fill the pdf's contacts info fields
                int counter = 0;
                for (Contact theContact : contacts) {
                    counter++;
                    fillContact(formFields, theContact, counter);

                }

                stamper.close();

                reader = new PdfReader(baos.toByteArray());
                //reader = new PdfReader(newFile);

                copy.addPage(copy.getImportedPage(reader, 1));

                document.close();
                String fileName = "ContactInfo_"+ theOrganization.getId()
+".pdf";

                financialContactEmailService.sendEmail(localToAddress,
fromAddress, theSubject, theEmailBody, fileName, theNewFile);
}

Thanx for any help
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to