java - PDF acroforms not being copied properly in itext -
so have pdf form , set fields it:
pdfreader reader = new pdfreader(src); pdfstamper stamper = new pdfstamper(reader, new fileoutputstream(dest + + ".pdf")); acrofields form = stamper.getacrofields(); form.setfield("name", "bruno lowagie"); form.setfield("adress", "address"); form.setfield("dates", "january 1, 2010"); form.setfield("titles", "blah blah blah"); stamper.close(); reader.close();
however when try copy files file, fields appear on focus of fields, pelase help
document document = new document(); pdfcopy pcf = new pdfcopy(document, new fileoutputstream(all_customer_file)); pcf.setmergefields(); document.open(); int documentnumber = 0; (string input : inputs) { pdfreader reader = new pdfreader(input); documentnumber++; renamefields(reader, documentnumber); pcf.adddocument(reader); } pcf.close(); document.close();
to experiencing same issue (currently using itext 5.4.4), able solve setting setappearance true acrofrom , setformflattening true:
acrofields form = stamper.getacrofields(); form.setgenerateappearances(true); form.setfield("name", "bruno lowagie" + i); form.setfield("adress", "address"); form.setfield("dates", "january 1, 2010"); form.setfield("titles", "blah blah blah"); stamper.setformflattening(true);
Comments
Post a Comment