Search in sources :

Example 1 with PDFileSpecification

use of com.tom_roush.pdfbox.pdmodel.common.filespecification.PDFileSpecification in project PdfBox-Android by TomRoush.

the class FDFDictionary method writeXML.

/**
 * This will write this element as an XML document.
 *
 * @param output The stream to write the xml to.
 *
 * @throws IOException If there is an error writing the XML.
 */
public void writeXML(Writer output) throws IOException {
    PDFileSpecification fs = this.getFile();
    if (fs != null) {
        output.write("<f href=\"" + fs.getFile() + "\" />\n");
    }
    COSArray ids = this.getID();
    if (ids != null) {
        COSString original = (COSString) ids.getObject(0);
        COSString modified = (COSString) ids.getObject(1);
        output.write("<ids original=\"" + original.toHexString() + "\" ");
        output.write("modified=\"" + modified.toHexString() + "\" />\n");
    }
    List<FDFField> fields = getFields();
    if (fields != null && fields.size() > 0) {
        output.write("<fields>\n");
        for (FDFField field : fields) {
            field.writeXML(output);
        }
        output.write("</fields>\n");
    }
}
Also used : PDFileSpecification(com.tom_roush.pdfbox.pdmodel.common.filespecification.PDFileSpecification) COSArray(com.tom_roush.pdfbox.cos.COSArray) COSString(com.tom_roush.pdfbox.cos.COSString)

Example 2 with PDFileSpecification

use of com.tom_roush.pdfbox.pdmodel.common.filespecification.PDFileSpecification in project PdfBox-Android by TomRoush.

the class FDFDictionary method getEmbeddedFDFs.

/**
 * This will get the list of embedded FDF entries, or null if the entry is null. This will return a list of
 * PDFileSpecification objects.
 *
 * @return A list of embedded FDF files.
 *
 * @throws IOException If there is an error creating the file spec.
 */
public List<PDFileSpecification> getEmbeddedFDFs() throws IOException {
    List<PDFileSpecification> retval = null;
    COSArray embeddedArray = (COSArray) fdf.getDictionaryObject(COSName.EMBEDDED_FDFS);
    if (embeddedArray != null) {
        List<PDFileSpecification> embedded = new ArrayList<PDFileSpecification>();
        for (int i = 0; i < embeddedArray.size(); i++) {
            embedded.add(PDFileSpecification.createFS(embeddedArray.get(i)));
        }
        retval = new COSArrayList<PDFileSpecification>(embedded, embeddedArray);
    }
    return retval;
}
Also used : PDFileSpecification(com.tom_roush.pdfbox.pdmodel.common.filespecification.PDFileSpecification) COSArray(com.tom_roush.pdfbox.cos.COSArray) ArrayList(java.util.ArrayList) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList)

Aggregations

COSArray (com.tom_roush.pdfbox.cos.COSArray)2 PDFileSpecification (com.tom_roush.pdfbox.pdmodel.common.filespecification.PDFileSpecification)2 COSString (com.tom_roush.pdfbox.cos.COSString)1 COSArrayList (com.tom_roush.pdfbox.pdmodel.common.COSArrayList)1 ArrayList (java.util.ArrayList)1