1
votes

Is there any way to flatten annotations in iText7/Java? I think previous versions had a PdfStamper class doing this, but I can't find it in iText7. PdfDocument seems to have replace PdfStamper to a large degree, but no flattening functionality?

Thanks, Thomas

1

1 Answers

0
votes

Code snippet below is for flattening form fields in iText7 given the path to a source document and a path for the output file:

PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(DEST));
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, true);
form.flattenFields();
pdfDoc.close();

.Net equivalent is form.FlattenFields();