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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.7
    • None
    • AcroForm
    • 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_result.pdf
          3 kB
          Artem Logachev
        2. flatten_fields.pdf
          3 kB
          Artem Logachev

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alogachev Artem Logachev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: