Class FdfReader

java.lang.Object
com.itextpdf.text.pdf.PdfReader
com.itextpdf.text.pdf.FdfReader
All Implemented Interfaces:
PdfViewerPreferences

public class FdfReader extends PdfReader
Reads an FDF form and makes the fields available
  • Field Details

  • Constructor Details

    • FdfReader

      public FdfReader(String filename) throws IOException
      Reads an FDF form.
      Parameters:
      filename - the file name of the form
      Throws:
      IOException - on error
    • FdfReader

      public FdfReader(byte[] pdfIn) throws IOException
      Reads an FDF form.
      Parameters:
      pdfIn - the byte array with the form
      Throws:
      IOException - on error
    • FdfReader

      public FdfReader(URL url) throws IOException
      Reads an FDF form.
      Parameters:
      url - the URL of the document
      Throws:
      IOException - on error
    • FdfReader

      public FdfReader(InputStream is) throws IOException
      Reads an FDF form.
      Parameters:
      is - the InputStream containing the document. The stream is read to the end but is not closed
      Throws:
      IOException - on error
  • Method Details

    • getCounter

      protected Counter getCounter()
      Overrides:
      getCounter in class PdfReader
    • readPdf

      protected void readPdf() throws IOException
      Description copied from class: PdfReader
      Parses the entire PDF
      Overrides:
      readPdf in class PdfReader
      Throws:
      IOException
    • kidNode

      protected void kidNode(PdfDictionary merged, String name)
    • readFields

      protected void readFields()
    • getFields

      public HashMap<String,PdfDictionary> getFields()
      Gets all the fields. The map is keyed by the fully qualified field name and the value is a merged PdfDictionary with the field content.
      Returns:
      all the fields
    • getField

      public PdfDictionary getField(String name)
      Gets the field dictionary.
      Parameters:
      name - the fully qualified field name
      Returns:
      the field dictionary
    • getAttachedFile

      public byte[] getAttachedFile(String name) throws IOException
      Gets a byte[] containing a file that is embedded in the FDF.
      Parameters:
      name - the fully qualified field name
      Returns:
      the bytes of the file
      Throws:
      IOException
      Since:
      5.0.1
    • getFieldValue

      public String getFieldValue(String name)
      Gets the field value or null if the field does not exist or has no value defined.
      Parameters:
      name - the fully qualified field name
      Returns:
      the field value or null
    • getFileSpec

      public String getFileSpec()
      Gets the PDF file specification contained in the FDF.
      Returns:
      the PDF file specification contained in the FDF