Flattening of PDF Files

Hi,

Aspose API provides multiple ways for flattening.

  1. for(Field formField : pdfDocument.getForm().getFields()){
    formField.flatten();
    }
  2. pdfDocument.flatten()

Which is the recommended way for flattening. The issue I have noticed is some pdf files are flatten by using the 1st approach and most of the others by second approach.

How should we figure out, when to use which approach.

Regards,

@nihhhs,

You can flatten a particular field or all form fields. In the first approach, you are iterating through all fields, and flattening each field one by one. The second approach flattens all fields of the form. Kindly send us the problematic PDF documents where the first or second approach is not working. We will investigate and share our findings with you.