use of com.tom_roush.pdfbox.pdmodel.common.COSArrayList in project PdfBox-Android by TomRoush.
the class FDFPage method getTemplates.
/**
* This will get a list of FDFTemplage objects that describe the named pages that serve as templates.
*
* @return A list of templates.
*/
public List<FDFTemplate> getTemplates() {
List<FDFTemplate> retval = null;
COSArray array = (COSArray) page.getDictionaryObject(COSName.TEMPLATES);
if (array != null) {
List<FDFTemplate> objects = new ArrayList<FDFTemplate>();
for (int i = 0; i < array.size(); i++) {
objects.add(new FDFTemplate((COSDictionary) array.getObject(i)));
}
retval = new COSArrayList<FDFTemplate>(objects, array);
}
return retval;
}
use of com.tom_roush.pdfbox.pdmodel.common.COSArrayList in project PdfBox-Android by TomRoush.
the class PDAction method getNext.
/**
* This will get the next action, or sequence of actions, to be performed after this one.
* The value is either a single action dictionary or an array of action dictionaries
* to be performed in order.
*
* @return The Next action or sequence of actions.
*/
public List<PDAction> getNext() {
List<PDAction> retval = null;
COSBase next = action.getDictionaryObject(COSName.NEXT);
if (next instanceof COSDictionary) {
PDAction pdAction = PDActionFactory.createAction((COSDictionary) next);
retval = new COSArrayList<PDAction>(pdAction, next, action, COSName.NEXT);
} else if (next instanceof COSArray) {
COSArray array = (COSArray) next;
List<PDAction> actions = new ArrayList<PDAction>();
for (int i = 0; i < array.size(); i++) {
actions.add(PDActionFactory.createAction((COSDictionary) array.getObject(i)));
}
retval = new COSArrayList<PDAction>(actions, array);
}
return retval;
}
use of com.tom_roush.pdfbox.pdmodel.common.COSArrayList in project PdfBox-Android by TomRoush.
the class PDPage method getAnnotations.
/**
* This will return a list of the annotations for this page.
*
* @param annotationFilter the annotation filter provided allowing to filter out specific annotations
* @return List of the PDAnnotation objects, never null. The returned list is backed by the
* annotations COSArray, so any adding or deleting in this list will change the document too.
*
* @throws IOException If there is an error while creating the annotation list.
*/
public List<PDAnnotation> getAnnotations(AnnotationFilter annotationFilter) throws IOException {
COSBase base = page.getDictionaryObject(COSName.ANNOTS);
if (base instanceof COSArray) {
COSArray annots = (COSArray) base;
List<PDAnnotation> actuals = new ArrayList<PDAnnotation>();
for (int i = 0; i < annots.size(); i++) {
COSBase item = annots.getObject(i);
if (item == null) {
continue;
}
PDAnnotation createdAnnotation = PDAnnotation.createAnnotation(item);
if (annotationFilter.accept(createdAnnotation)) {
actuals.add(createdAnnotation);
}
}
return new COSArrayList<PDAnnotation>(actuals, annots);
}
return new COSArrayList<PDAnnotation>(page, COSName.ANNOTS);
}
use of com.tom_roush.pdfbox.pdmodel.common.COSArrayList in project PdfBox-Android by TomRoush.
the class PDAcroForm method getFields.
/**
* This will return all of the documents root fields.
*
* A field might have children that are fields (non-terminal field) or does not
* have children which are fields (terminal fields).
*
* The fields within an AcroForm are organized in a tree structure. The documents root fields
* might either be terminal fields, non-terminal fields or a mixture of both. Non-terminal fields
* mark branches which contents can be retrieved using {@link PDNonTerminalField#getChildren()}.
*
* @return A list of the documents root fields, never null. If there are no fields then this
* method returns an empty list.
*/
public List<PDField> getFields() {
COSArray cosFields = (COSArray) dictionary.getDictionaryObject(COSName.FIELDS);
if (cosFields == null) {
return Collections.emptyList();
}
List<PDField> pdFields = new ArrayList<PDField>();
for (int i = 0; i < cosFields.size(); i++) {
COSDictionary element = (COSDictionary) cosFields.getObject(i);
if (element != null) {
PDField field = PDField.fromDictionary(this, element, null);
if (field != null) {
pdFields.add(field);
}
}
}
return new COSArrayList<PDField>(pdFields, cosFields);
}
use of com.tom_roush.pdfbox.pdmodel.common.COSArrayList in project PdfBox-Android by TomRoush.
the class PDSeedValue method getSubFilter.
/**
* If <b>SubFilter</b> is not null and the {@link #isSubFilterRequired()} indicates this
* entry is a required constraint, then the first matching encodings shall be used when
* signing; otherwise, signing shall not take place. If {@link #isSubFilterRequired()}
* indicates that this is an optional constraint, then the first matching encoding shall
* be used if it is available. If it is not available, a different encoding may be used
* instead.
*
* @return the subfilter that shall be used by the signature handler
*/
public List<String> getSubFilter() {
List<String> retval = null;
COSArray fields = (COSArray) dictionary.getDictionaryObject(COSName.SUB_FILTER);
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;
}
Aggregations