Hi all,

I am using iText5.0.4.jar. I want to merge 2 pdf files and show the
prepoluated data in pdf fields and leave them editable.

Before merge process, I need to get data from the database and populate the
pdf acrofields.
I am getting 2 PdfReader objects for 2 pdf files after populating pdf files
with data.
I am using the below given code for merging pdf files.

=======================================================================
ByteArrayOutputStream out = new ByteArrayOutputStream();
           Document pdfDocument = new Document();
           //pdfDocument.
           com.itextpdf.text.pdf.PdfWriter writer =
PdfWriter.getInstance(pdfDocument,out);
           pdfDocument.open();
           
                        
           com.itextpdf.text.pdf.PdfContentByte cb = writer.getDirectContent();
// Holds the PDF
           pdfDocument.newPage();
                        
           Set> set = readerMap.entrySet();
                        
           java.util.Iterator> iter = set.iterator();
           Map.Entry entry = null;
           int totalPages = 0;

           while (iter.hasNext()) {
                   entry = (Map.Entry) iter.next();                
                   totalPages = entry.getValue().getNumberOfPages();
                   reader = entry.getValue();
                   // Importing multiple pages;
                   for(int i=1;i<=totalPages; i++){
                           cb.addTemplate(writer.getImportedPage(reader,i), 0, 
0);
                           pdfDocument.newPage();
                   }
                   reader.close();
                   
                   // reset total pages for next reader;
                   totalPages = 0;
                   }
           
           
           pdfDocument.close();
=======================================================================



Now app is opening and merging the 2 pdf files successfully but not showing
any DB data that was populated.

if i use stamper.setFormFlattening(false) then app wont show any
prepopulated data and make all the fields non editable.
if i use stamper.setFormFlattening(true) then app shows the prepopulated
data but make all the fields non editable.



Objective:
I want to show the prepoluated data as well as leave the fields editable for
the end users.

Thanks in advance,
Mahmood












--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Merge-2-pdf-files-not-displaying-prepopulated-data-tp3336481p3336481.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText&#174; 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