private static void addAllAppearances(PDAppearanceEntry appearance, List<PDAppearanceStream> list) { if (appearance == null) { return; } if (appearance.isSubDictionary()) { for (PDAppearanceStream appearanceStream : appearance.getSubDictionary().values()) { if (appearanceStream != null) { list.add(appearanceStream); } } } else { PDAppearanceStream appearanceStream = appearance.getAppearanceStream(); if (appearanceStream != null) { list.add(appearanceStream); } } }
public PDAppearanceStream getAppearanceStream() { if (isSubDictionary()) { throw new IllegalStateException("Current appearance entry is not a stream"); } return new PDAppearanceStream(getObject()); } }
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); }
@Override public String getN_type() { PDAppearanceEntry normalAppearance = ((PDAnnotation) simplePDObject).getNormalAppearance(); if (normalAppearance == null) { return null; } else if (normalAppearance.isSubDictionary()) { return DICT; } else { return STREAM; } }
public boolean isSubDictionary() { return getObject().getType() == COSObjType.COS_DICT; }
private PDAppearanceEntry getAppearanceEntry(ASAtom key) { COSObject appearanceDictionary = getCOSAP(); if (appearanceDictionary != null) { COSObject appearance = appearanceDictionary.getKey(key); if (appearance != null && appearance.getType().isDictionaryBased()) { return new PDAppearanceEntry(appearance); } } return null; }
private void addContentStreamsFromAppearanceEntry(PDAppearanceEntry appearanceEntry, List<PDContentStream> appearances) { if (appearanceEntry != null) { if (appearanceEntry.isSubDictionary()) { Map<ASAtom, PDAppearanceStream> subDictionary = appearanceEntry.getSubDictionary(); for (PDAppearanceStream stream : subDictionary.values()) { addAppearance(appearances, stream); } } else { addAppearance(appearances, appearanceEntry.getAppearanceStream()); } } }
private Set<String> getAppearanceEntryDependencies(PDAppearanceEntry entry) { Set<String> res = new HashSet<>(); if (entry.isSubDictionary()) { for (Map.Entry<ASAtom, PDAppearanceStream> mapEntry : entry.getSubDictionary().entrySet()) { res.add(getAppearanceStreamDependencies(mapEntry.getValue())); } } else { res.add(getAppearanceStreamDependencies(entry.getAppearanceStream())); } return res; }