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

Flatten does not work properly on field with type 0 font

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.10
    • 2.0.14, 3.0.0 PDFBox
    • AcroForm
    • None
    • win10, JDK 1.8

    Description

      Pdf form sampleform_filled.pdf contains one field called "txtField" with this content: "ěščřžýáíéúůóďťĚŠČŘŽÝÁÍÉÚŮÓĎŤ".  The font used in this field is "/F5"

      when you run this code:

       

      try {
       PDDocument sourcePdfForm = PDDocument.load(new File("sampleform_filled.pdf"));
       PDAcroForm acroForm = sourcePdfForm.getDocumentCatalog()
       .getAcroForm();
      
       acroForm.flatten();
       sourcePdfForm.save("sampleform_filled_flattened.pdf");
      } catch (IOException e) {
       e.printStackTrace();
      }

       

       

      You will get sampleform_filled_flattened.pdf with empty or not visible content of the field.

       

       

      Attachments

        1. sampleform_filled_in_acrobat_reader.png
          17 kB
          rumburak
        2. sampleform_filled_flattened.pdf
          33 kB
          rumburak
        3. sampleform_filled.pdf
          33 kB
          rumburak

        Activity

          People

            tilman Tilman Hausherr
            rumburak rumburak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: