Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3941

PDAcroForm.flatten(List<PDField>, boolean) works incorrectly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.7
    • Fix Version/s: None
    • Component/s: AcroForm
    • Labels:
      None

      Description

      Documentation for PDAcroForm.flatten(List<PDField>, boolean) says "This will flatten the specified form fields".
      But the following code works same as PDAcroForm.flatten() though excepted to flatten only one field.

      PDDocument document = PDDocument.load(new File("/flatten_fields.pdf"));
      PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
      List<PDField> fields = new ArrayList<>(); 
      fields.add(acroForm.getField("flatten"));
      acroForm.flatten(fields, true);
      document.save("/flatten_result.pdf");
      document.close();
      

        Attachments

        1. flatten_fields.pdf
          3 kB
          Artem Logachev
        2. flatten_result.pdf
          3 kB
          Artem Logachev

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                alogachev Artem Logachev
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: