use of com.tom_roush.pdfbox.pdmodel.common.COSObjectable in project PdfBox-Android by TomRoush.
the class FDFField method setValue.
/**
* You should pass in a string, or a java.util.List of strings to set the value.
*
* @param value The value that should populate when imported.
*
* @throws IOException If there is an error setting the value.
*/
public void setValue(Object value) throws IOException {
COSBase cos = null;
if (value instanceof List) {
cos = COSArrayList.convertStringListToCOSStringCOSArray((List<String>) value);
} else if (value instanceof String) {
cos = new COSString((String) value);
} else if (value instanceof COSObjectable) {
cos = ((COSObjectable) value).getCOSObject();
} else if (value != null) {
throw new IOException("Error:Unknown type for field import" + value);
}
field.setItem(COSName.V, cos);
}
Aggregations