use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.
the class PDFontDescriptor method getPanose.
/**
* Returns the Panose entry of the Style dictionary, if any.
*
* @return A Panose wrapper object.
*/
public PDPanose getPanose() {
COSDictionary style = (COSDictionary) dic.getDictionaryObject(COSName.STYLE);
if (style != null) {
COSString panose = (COSString) style.getDictionaryObject(COSName.PANOSE);
byte[] bytes = panose.getBytes();
return new PDPanose(bytes);
}
return null;
}
use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.
the class FDFTemplate method getTemplateReference.
/**
* This is the template reference.
*
* @return The template reference.
*/
public FDFNamedPageReference getTemplateReference() {
FDFNamedPageReference retval = null;
COSDictionary dict = (COSDictionary) template.getDictionaryObject(COSName.TREF);
if (dict != null) {
retval = new FDFNamedPageReference(dict);
}
return retval;
}
use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.
the class MergeAcroFormsTest method compareFieldProperties.
private void compareFieldProperties(PDField sourceField, PDField toBeComapredField) {
// List of keys for comparison
// Don't include too complex properties such as AP as this will fail the test because
// of a stack overflow when
final String[] keys = { "FT", "T", "TU", "TM", "Ff", "V", "DV", "Opts", "TI", "I", "Rect", "DA" };
COSDictionary sourceFieldCos = sourceField.getCOSObject();
COSDictionary toBeComparedCos = toBeComapredField.getCOSObject();
for (String key : keys) {
COSBase sourceBase = sourceFieldCos.getDictionaryObject(key);
COSBase toBeComparedBase = toBeComparedCos.getDictionaryObject(key);
if (sourceBase != null) {
assertEquals("The content of the field properties shall be the same", sourceBase.toString(), toBeComparedBase.toString());
} else {
assertNull("If the source property is null the compared property shall be null too", toBeComparedBase);
}
}
}
use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.
the class PDStructureTreeRoot method setRoleMap.
/**
* Sets the role map.
*
* @param roleMap the role map
*/
public void setRoleMap(Map<String, String> roleMap) {
COSDictionary rmDic = new COSDictionary();
for (Map.Entry<String, String> entry : roleMap.entrySet()) {
rmDic.setName(entry.getKey(), entry.getValue());
}
this.getCOSObject().setItem(COSName.ROLE_MAP, rmDic);
}
use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.
the class PDUserAttributeObject method getOwnerUserProperties.
/**
* Returns the user properties.
*
* @return the user properties
*/
public List<PDUserProperty> getOwnerUserProperties() {
COSArray p = (COSArray) this.getCOSObject().getDictionaryObject(COSName.P);
List<PDUserProperty> properties = new ArrayList<PDUserProperty>(p.size());
for (int i = 0; i < p.size(); i++) {
properties.add(new PDUserProperty((COSDictionary) p.getObject(i), this));
}
return properties;
}
Aggregations