Example usage for org.apache.pdfbox.pdmodel.interactive.form PDField getFieldType

List of usage examples for org.apache.pdfbox.pdmodel.interactive.form PDField getFieldType

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.form PDField getFieldType.

Prototype

public abstract String getFieldType();

Source Link

Document

Get the FT entry of the field.

Usage

From source file:pdf.to.info.PDF.java

/**
 * Reading fields of a PDF file//w ww .j  av  a  2  s .  co  m
 *
 * @param filePath
 * @throws java.io.IOException
 */
public void PdfFields(String filePath) throws IOException {
    PDDocument pdDoc = ReadPDDoc(filePath);
    PDAcroForm form = pdDoc.getDocumentCatalog().getAcroForm();
    if (form != null) {
        List FieldTy = form.getFields();
        PDField pdfFields;
        for (int i = 0; i < FieldTy.size(); i++) {
            pdfFields = (PDField) FieldTy.get(i);
            String fieldNameTyope = pdfFields.getFieldType();
            System.out.println(fieldNameTyope);
        }
    } else {
        System.out.print("There is no standard field in your PDF file.\n");
    }
}