I have a dynamic pdf form , which is filled programatically from xml input data by using iText APIs. But when we print the filled dynamic pdf form, blank page is printed. If we open and save the output pdf and then print, its working fine.
Can anybody help why would be the reason for blank page and how this issue can be resolved?
My form filling code:
PdfReader reader=new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader,new FileOutputStream(dest),'\0', true);
PdfWriter writer=stamper.getWriter();
File file = new File(src);
String fileName=file.getName();
PdfAction action = null;
action = PdfAction.javaScript(readJsFileTostring(jsFileName), writer);
writer.setOpenAction(action);
stamper.setPageAction(PdfWriter.PAGE_OPEN, action, 1);
AcroFields form = stamper.getAcroFields();
XfaForm xfa = form.getXfa();
xfa.fillXfaForm(new FileInputStream(xmlData));
stamper.close();
I use Adobe Acrobat Reader DC 2018.009.20050 to print the form.