public Set<ASAtom> getKeySet() { return getDirect().getKeySet(); }
@Override public Map<String, String> getCustomValues() { if (info != null && info.getType() == COSObjType.COS_DICT) { Map<String, String> res = new TreeMap<>(); Set<ASAtom> keys = new TreeSet<>(info.getKeySet()); keys.removeAll(Arrays.asList(predefinedKeys)); for (ASAtom key : keys) { res.put(key.getValue(), info.getStringKey(key)); } return Collections.unmodifiableMap(res); } return Collections.emptyMap(); }
@Override public String getAP() { COSObject apLocal = ((PDAnnotation) simplePDObject).getCOSAP(); if (apLocal != null) { StringBuilder result = new StringBuilder(); for (ASAtom key : apLocal.getKeySet()) { result.append(key.getValue()); result.append(' '); } //remove last whitespace character return result.length() <= 0 ? result.toString() : result.substring(0, result.length() - 1); } return null; }
private Set<ASAtom> getNames(ASAtom type) { COSObject dict = getKey(type); if (dict != null && dict.getType() == COSObjType.COS_DICT) { return dict.getKeySet(); } return Collections.emptySet(); }
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(); }
private Map<ASAtom, PDCryptFilter> getCryptFilters() { HashMap<ASAtom, PDCryptFilter> res = new HashMap<>(); COSObject cf = getKey(ASAtom.CF); if (cf == null || cf.getType() != COSObjType.COS_DICT) { return res; } Set<ASAtom> filters = cf.getKeySet(); for (ASAtom filterName : filters) { res.put(filterName, new PDCryptFilter(cf.getKey(filterName))); } return res; }
public Map<ASAtom, PDAppearanceStream> getSubDictionary() { if (!isSubDictionary()) { throw new IllegalStateException("Current appearance entry is a stream"); } Map<ASAtom, PDAppearanceStream> res = new HashMap<>(); for (ASAtom key : getObject().getKeySet()) { COSObject obj = getKey(key); if (obj.isIndirect()) { obj = obj.getDirect(); } if (obj != null && obj.getType() == COSObjType.COS_STREAM) { res.put(key, new PDAppearanceStream(obj)); } } return Collections.unmodifiableMap(res); }
private List<org.verapdf.model.pdlayer.PDHalftone> getHalftones() { Long halftoneType = getHalftoneType(); if (halftoneType == null || halftoneType != 5L) { return Collections.emptyList(); } List<org.verapdf.model.pdlayer.PDHalftone> halftones = new ArrayList<>(); COSObject object = this.simplePDObject.getObject(); if (object != null && object.getType().isDictionaryBased()) { for (ASAtom key : object.getKeySet()) { COSObject value = object.getKey(key); if (value.getType().isDictionaryBased()) { PDHalftone halftone = new PDHalftone(value); GFPDHalftone gfPDHalftone = new GFPDHalftone(halftone, key); halftones.add(gfPDHalftone); } } } return Collections.unmodifiableList(halftones); } }
private static boolean areColorantsPresent(org.verapdf.pd.colors.PDDeviceN simplePDObject) { COSObject attributes = simplePDObject.getAttributes(); if (attributes != null && attributes.getType() == COSObjType.COS_DICT) { COSObject colorantsDict = attributes.getKey(ASAtom.COLORANTS); List<COSObject> colorantsArray = simplePDObject.getNames(); Set<ASAtom> componentNames = new TreeSet<>(); if (colorantsDict != null && colorantsDict.getType() == COSObjType.COS_DICT) { componentNames.addAll(colorantsDict.getKeySet()); } COSArray components = getProcessComponents(attributes); if (components != null) { for (COSObject component : components) { if (component.getType() == COSObjType.COS_NAME) { componentNames.add(component.getName()); } } } return GFPDDeviceN.areColorantsPresent(componentNames, colorantsArray); } return false; }