Search in sources :

Example 1 with FDFDictionary

use of com.tom_roush.pdfbox.pdmodel.fdf.FDFDictionary in project PdfBox-Android by TomRoush.

the class PDAcroForm method exportFDF.

/**
 * This will export all FDF form data.
 *
 * @return An FDF document used to export the document.
 * @throws IOException If there is an error when exporting the document.
 */
public FDFDocument exportFDF() throws IOException {
    FDFDocument fdf = new FDFDocument();
    FDFCatalog catalog = fdf.getCatalog();
    FDFDictionary fdfDict = new FDFDictionary();
    catalog.setFDF(fdfDict);
    List<FDFField> fdfFields = new ArrayList<FDFField>();
    List<PDField> fields = getFields();
    for (PDField field : fields) {
        fdfFields.add(field.exportFDF());
    }
    fdfDict.setID(document.getDocument().getDocumentID());
    if (!fdfFields.isEmpty()) {
        fdfDict.setFields(fdfFields);
    }
    return fdf;
}
Also used : ArrayList(java.util.ArrayList) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList) FDFField(com.tom_roush.pdfbox.pdmodel.fdf.FDFField) FDFDocument(com.tom_roush.pdfbox.pdmodel.fdf.FDFDocument) FDFCatalog(com.tom_roush.pdfbox.pdmodel.fdf.FDFCatalog) FDFDictionary(com.tom_roush.pdfbox.pdmodel.fdf.FDFDictionary)

Aggregations

COSArrayList (com.tom_roush.pdfbox.pdmodel.common.COSArrayList)1 FDFCatalog (com.tom_roush.pdfbox.pdmodel.fdf.FDFCatalog)1 FDFDictionary (com.tom_roush.pdfbox.pdmodel.fdf.FDFDictionary)1 FDFDocument (com.tom_roush.pdfbox.pdmodel.fdf.FDFDocument)1 FDFField (com.tom_roush.pdfbox.pdmodel.fdf.FDFField)1 ArrayList (java.util.ArrayList)1