Combine FDF and PDF without PDFTK

Is there a way to combine the FDF file and the PDF file to create a flat format of all data and form in 1 pdf without using PDFTK?

Any light shed on this will be greatly appreciated.

+5
source share
1 answer

No. There is no other way to smooth out a bit, but it's awesome. Why do you need anything else?

PDFTK is basically Java (literally hundreds of Java files). You might think about wrapping your project around it. The functionality you are looking for is here (java / com / lowagie / text / pdf / AcroFields.java: 931):

/** Sets the fields by XFDF merging.
 * @param xfdf the XFDF form
 * @throws IOException on error
 * @throws DocumentException on error
 */
public boolean setFields(XfdfReader xfdf) throws IOException, DocumentException {
    boolean ret_val_b= false; // ssteward
    xfdf.getFields();
    for (Iterator i = fields.keySet().iterator(); i.hasNext();) {
        String f = (String)i.next();
        String v = xfdf.getFieldValue(f);
        String rv = xfdf.getFieldRichValue(f); // ssteward
        if (rv != null)
            ret_val_b= true;
        if (v != null)
            setField(f, v, v, rv); // ssteward
    }
    return ret_val_b; // ssteward
}
0
source

All Articles