public ASAtom getNameKey(final ASAtom key) { return object.getNameKey(key); }
@Override public boolean hasCryptFilter() { return !ASAtom.IDENTITY.equals(base.getNameKey(ASAtom.NAME)); } }
public ASAtom getSubtype() { return getObject().getNameKey(ASAtom.SUBTYPE); }
public ASAtom getNameKey(final ASAtom key) { return getDirect().getNameKey(key); }
public ASAtom getType() { return getObject().getNameKey(ASAtom.TYPE); }
public ASAtom getSubtype() { return getObject().getNameKey(ASAtom.SUBTYPE); }
public ASAtom getN() { return getObject().getNameKey(ASAtom.N); } }
public ASAtom getSubtype() { return getObject().getNameKey(ASAtom.S); }
public ASAtom getSubtype() { return getObject().getNameKey(ASAtom.S); }
public ASAtom getSubtype2() { return getObject().getNameKey(ASAtom.SUBTYPE_2); }
private static boolean isStructElem(COSObject dictionary, boolean checkType) { if (dictionary == null || dictionary.getType() != COSObjType.COS_DICT) { return false; } ASAtom type = dictionary.getNameKey(ASAtom.TYPE); return !checkType || type == null || type.equals(ASAtom.STRUCT_ELEM); } }
private static ASAtom getFieldTypeCOSObject(COSObject field) { ASAtom res = field.getNameKey(ASAtom.FT); if (res != null) { return res; } COSObject parent = field.getKey(ASAtom.PARENT); if (parent != null) { return getFieldTypeCOSObject(parent); } return null; } }
private String getNameKey(ASAtom key) { if (info != null && info.getType() == COSObjType.COS_DICT) { ASAtom atom = info.getNameKey(key); return atom == null ? null : atom.getValue(); } return null; } }
private static void addObjectWithTypeKeyCheck(List<COSObject> objects, COSObject obj, ASAtom type) { if (obj != null && !obj.empty() && obj.getType().isDictionaryBased()) { ASAtom actualType = obj.getNameKey(ASAtom.TYPE); if (actualType == type) { objects.add(obj); } } }
public Map<ASAtom, ASAtom> getRoleMap() { COSObject roleMap = getKey(ASAtom.ROLE_MAP); if (roleMap != null && roleMap.getType() == COSObjType.COS_DICT && roleMap.size() > 0) { Map<ASAtom, ASAtom> res = new HashMap<>(); Set<ASAtom> keys = roleMap.getKeySet(); for (ASAtom key : keys) { ASAtom value = roleMap.getNameKey(key); if (value != null) { res.put(key, value); } } return Collections.unmodifiableMap(res); } return Collections.emptyMap(); }
public ASAtom getFT() { Set<COSKey> visitedKeys = new HashSet<>(); COSObject curr = getObject(); while (curr != null && curr.getType().isDictionaryBased()) { COSKey key = curr.getObjectKey(); if (key != null) { if (visitedKeys.contains(key)) { throw new LoopedException("Loop in field tree"); } visitedKeys.add(key); } if (curr.knownKey(ASAtom.FT)) { return curr.getNameKey(ASAtom.FT); } curr = curr.getKey(ASAtom.PARENT); } return null; }
private void setRequiredDictionaryValue(ASAtom value, ASAtom key, MetadataFixerResultImpl.Builder resultBuilder) { if (!value.equals(this.stream.getNameKey(key))) { this.stream.setNameKey(key, value); this.doc.addChangedObject(stream); resultBuilder.addFix(value.getValue() + " value of " + key.getValue() + " key is set to metadata dictionary"); } }
public static PDXObject getTypedPDXObject(COSObject object, PDResources resources) { if (object != null) { ASAtom type = object.getNameKey(ASAtom.SUBTYPE); if (ASAtom.IMAGE.equals(type)) { return new PDXImage(object, resources); } else if (ASAtom.FORM.equals(type)) { return new PDXForm(object); } else if (ASAtom.PS.equals(type)) { return new PDXPostScript(object); } } return null; } }
@Override public String getEncoding() { if (font != null && !font.empty()) { COSObject enc = font.getEncoding(); if (enc.getType() == COSObjType.COS_NAME) { return enc.getString(); } else if (enc.getType() == COSObjType.COS_DICT) { ASAtom name = enc.getNameKey(ASAtom.BASE_ENCODING); return name == null ? null : name.getValue(); } } return null; }
private boolean isNonTerminalField() { COSObject kids = getKey(ASAtom.KIDS); if (kids != null && kids.getType() == COSObjType.COS_ARRAY) { for (COSObject elem : (COSArray) kids.getDirectBase()) { if (elem == null || !elem.getType().isDictionaryBased() || ASAtom.ANNOT.equals(elem.getNameKey(ASAtom.TYPE))) { return false; } } return true; } return false; }