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

ClassCastException in FDF export

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.10
    • 1.8.11
    • AcroForm
    • None

    Description

      We have some simple code extracting FDF from a PDF like

      PDDocument pdf = PDDocument.load(inputStream);
      PDAcroForm form = pdf.getDocumentCatalog().getAcroForm();
      FDFDocument fdf = form.exportFDF();
      

      Everything was fine with previous versions of pdfbox (1.8.8 in particular) but version 1.8.10 throws an exception :

      java.lang.ClassCastException: org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget cannot be cast to org.apache.pdfbox.pdmodel.interactive.form.PDField
      	at org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.addFieldAndChildren(PDAcroForm.java:168)
      	at org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.exportFDF(PDAcroForm.java:145)
      

      I join the sample PDF that was used for this test

      Attachments

        1. formulaire_rempli.pdf
          1.84 MB
          Laurent Richard

        Activity

          People

            msahyoun Maruan Sahyoun
            lrichard Laurent Richard
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: