Reputation: 701
Setting
a) I have a reader extended XFA form (that contains 2 barcodes)
b) I have prepopulation XML
Intended Solution
- Prepopulate the XFA form with XML and then flatten the PDF (so that it is view-able in browsers, etc)
What's working
- Prepopulating of the XFA form is working and all fields & barcodes are populated as required (1 pager is generated) - looks perfect
The Problem / What's not working
- The second part of my code pickups the prepopulated PDF and then flattens the XFA form, the resultant pdf is now magically a 2 pager.
- The inbody barcode appears on the first page and all the other contents are incorrectly pushed to the second page.
- The positioning of all the elements are relatively correct, however split over two pages - they should all be on 1 page.
- The form & fields is flattened and views in a browser
For interest sake
I've 'flattened' the form using various forms of code, examples below
PDF FLATTENING CODE A
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new
FileOutputStream(dest));
stamper.setFormFlattening(true);
stamper.close();
PDF FLATTENING CODE B
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new File(dest)));
XFAFlattener xfaf = new XFAFlattener(document, writer);
xfaf.flatten(new PdfReader(fileToByteArray(src)));
document.close();
QUESTIONS
- Am I perhaps using the wrong 'flattening' code?
- Has any body experienced something similar?
- Why is this happening
- How can this be solved
Super appreciate any input here.
REF: SUP-1858
Upvotes: 1
Views: 686
Reputation: 701
Just to keep the community updated
Solution (not quite ideal)
We removed a mysterious blank subform from the XFA and the flattened iText solution worked - 1 beautiful page!
My Interpretation:
How iText handles/interprets a XFA blank subform
VS
How AEM Forms (under the covers Livecycle Forms) handles/interprets a blank XFA subform
seems to be slightly different.
If anything else comes us with further findings, we'll (8 BIT PLATOON) update this page and let you know.
Thanks to the iText team assisting in the background.
Upvotes: 1