Search in sources :

Example 11 with COSArrayList

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

the class PDSeedValue method getDigestMethod.

/**
 * An array of names indicating acceptable digest algorithms to use when
 * signing. The value shall be one of <b>SHA1</b>, <b>SHA256</b>, <b>SHA384</b>,
 * <b>SHA512</b>, <b>RIPEMD160</b>. The default value is implementation-specific.
 *
 * @return the digest method that shall be used by the signature handler
 */
public List<String> getDigestMethod() {
    List<String> retval = null;
    COSArray fields = (COSArray) dictionary.getDictionaryObject(COSName.DIGEST_METHOD);
    if (fields != null) {
        List<String> actuals = new ArrayList<String>();
        for (int i = 0; i < fields.size(); i++) {
            String element = fields.getName(i);
            if (element != null) {
                actuals.add(element);
            }
        }
        retval = new COSArrayList<String>(actuals, fields);
    }
    return retval;
}
Also used : COSArray(com.tom_roush.pdfbox.cos.COSArray) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList) ArrayList(java.util.ArrayList)

Example 12 with COSArrayList

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

the class PDSeedValue method getReasons.

/**
 * If the Reasons array is provided and {@link #isReasonRequired()} indicates that
 * Reasons is a required constraint, one of the reasons in the array shall be used
 * for the signature dictionary; otherwise signing shall not take place. If the
 * {@link #isReasonRequired()} indicates Reasons is an optional constraint, one of
 * the reasons in the array may be chose or a custom reason can be provided.
 *
 * @return the reasons that should be used by the signature handler
 */
public List<String> getReasons() {
    List<String> retval = null;
    COSArray fields = (COSArray) dictionary.getDictionaryObject(COSName.REASONS);
    if (fields != null) {
        List<String> actuals = new ArrayList<String>();
        for (int i = 0; i < fields.size(); i++) {
            String element = fields.getString(i);
            if (element != null) {
                actuals.add(element);
            }
        }
        retval = new COSArrayList<String>(actuals, fields);
    }
    return retval;
}
Also used : COSArray(com.tom_roush.pdfbox.cos.COSArray) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList) ArrayList(java.util.ArrayList)

Example 13 with COSArrayList

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

the class FDFDictionary method getFields.

/**
 * This will get the list of FDF Fields. This will return a list of FDFField objects.
 *
 * @return A list of FDF fields.
 */
public List<FDFField> getFields() {
    List<FDFField> retval = null;
    COSArray fieldArray = (COSArray) fdf.getDictionaryObject(COSName.FIELDS);
    if (fieldArray != null) {
        List<FDFField> fields = new ArrayList<FDFField>();
        for (int i = 0; i < fieldArray.size(); i++) {
            fields.add(new FDFField((COSDictionary) fieldArray.getObject(i)));
        }
        retval = new COSArrayList<FDFField>(fields, fieldArray);
    }
    return retval;
}
Also used : COSArray(com.tom_roush.pdfbox.cos.COSArray) COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary) ArrayList(java.util.ArrayList) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList)

Example 14 with COSArrayList

use of com.tom_roush.pdfbox.pdmodel.common.COSArrayList 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)

Example 15 with COSArrayList

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

the class FDFDictionary method getAnnotations.

/**
 * This will get the list of FDF Annotations. This will return a list of FDFAnnotation objects or null if the entry
 * is not set.
 *
 * @return A list of FDF annotations.
 *
 * @throws IOException If there is an error creating the annotation list.
 */
public List<FDFAnnotation> getAnnotations() throws IOException {
    List<FDFAnnotation> retval = null;
    COSArray annotArray = (COSArray) fdf.getDictionaryObject(COSName.ANNOTS);
    if (annotArray != null) {
        List<FDFAnnotation> annots = new ArrayList<FDFAnnotation>();
        for (int i = 0; i < annotArray.size(); i++) {
            annots.add(FDFAnnotation.create((COSDictionary) annotArray.getObject(i)));
        }
        retval = new COSArrayList<FDFAnnotation>(annots, annotArray);
    }
    return retval;
}
Also used : COSArray(com.tom_roush.pdfbox.cos.COSArray) COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary) ArrayList(java.util.ArrayList) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList)

Aggregations

COSArray (com.tom_roush.pdfbox.cos.COSArray)18 COSArrayList (com.tom_roush.pdfbox.pdmodel.common.COSArrayList)18 ArrayList (java.util.ArrayList)17 COSDictionary (com.tom_roush.pdfbox.cos.COSDictionary)10 COSBase (com.tom_roush.pdfbox.cos.COSBase)4 PDAnnotation (com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAnnotation)2 COSDocument (com.tom_roush.pdfbox.cos.COSDocument)1 COSString (com.tom_roush.pdfbox.cos.COSString)1 PDFileSpecification (com.tom_roush.pdfbox.pdmodel.common.filespecification.PDFileSpecification)1 PDAnnotationWidget (com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget)1 PDAcroForm (com.tom_roush.pdfbox.pdmodel.interactive.form.PDAcroForm)1 PDField (com.tom_roush.pdfbox.pdmodel.interactive.form.PDField)1 PDSignatureField (com.tom_roush.pdfbox.pdmodel.interactive.form.PDSignatureField)1 PDThread (com.tom_roush.pdfbox.pdmodel.interactive.pagenavigation.PDThread)1 PDThreadBead (com.tom_roush.pdfbox.pdmodel.interactive.pagenavigation.PDThreadBead)1 List (java.util.List)1