Hi all,
I've got a PDF form that has a dynamic subform in it. My goal is to combine an original PDF and the XDP datasets from a submitted form into a single PDF. This is working just fine. However, if I call setFormFlattening(true) on the PdfStamper then the dynamic subforms do not show up. If I don't "flatten" the form then they appear just fine.

Unfortunately flattening is a requirement for what I'm doing. It appears that other Java libaries (I tried JPedel) do the exact same thing - they chop off all but the first dynamic subform.

My code looks like:

// XDPDOMParser is an XML parser class that understands the format of XDP
// data.  It uses standard Java XML DOM parsing.

FileOutputStream pdfOutputStream = new FileOutputStream( getOutputPdfFileName() );
PdfReader inputReader = new PdfReader( getInputPdfFileName() );
PdfStamper pdfStamper = new PdfStamper( inputReader, pdfOutputStream );
XDPDOMParser inputParser = new XDPDOMParser( getInputXdpFileName() );

XfaForm xfaForm = new XfaForm( pdfStamper.getReader() );
XDPDOMParser xdpParser = new XDPDOMParser( xfaForm.getDomDocument() );

// replace the datasets in the existing PDF with the contents of the XDP datasets
xdpParser.copyDataSets( inputParser.getDocument() );

xfaForm.setChanged( true );

XfaForm.setXfa( xfaForm, pdfStamper.getReader(), pdfStamper.getWriter() );

// pdfStamper.setFormFlattening(true); // if run, chops off the dynamic subforms after the first
pdfStamper.setFullCompression();
pdfStamper.close();
pdfOutputStream.close();

I can email the PDF I'm using if needed.

Is there anything obviously wrong that you can see?

Environment is Java 1.6.0_13, iText 2.1.7.  This is a version 1.6 PDF.




Scott Dunbar
Xigole Systems, Inc.
Enterprise consulting, development, and hosting
303·667·6343
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to