/** * Get the annotations down appearance. * * <p> * This will get the annotations down appearance. If this is not existent an * empty appearance entry will be created. * * @return the appearance entry representing the down appearance. */ PDAppearanceEntry getDownAppearance() { PDAppearanceDictionary appearanceDictionary = getAppearance(); PDAppearanceEntry downAppearanceEntry = appearanceDictionary.getDownAppearance(); if (downAppearanceEntry.isSubDictionary()) { //TODO replace with "document.getDocument().createCOSStream()" downAppearanceEntry = new PDAppearanceEntry(new COSStream()); appearanceDictionary.setDownAppearance(downAppearanceEntry); } return downAppearanceEntry; }
private static List<PDAppearanceStream> getAllAppearances(PDAnnotation annotation) { List<PDAppearanceStream> res = new ArrayList<>(); if (annotation != null) { PDAppearanceDictionary appearance = annotation.getAppearance(); if (appearance != null) { addAllAppearances(appearance.getNormalAppearance(), res); addAllAppearances(appearance.getDownAppearance(), res); addAllAppearances(appearance.getRolloverAppearance(), res); } } return res; }
private Set<String> getAnnotationResourcesDependencies(PDAnnotation annot) { PDAppearanceDictionary dic = annot.getAppearance(); Set<String> appearances = new HashSet<>(); if (dic != null) { COSBase baseNormal = dic.getCOSObject().getItem(COSName.N); if (baseNormal != null) { appearances.addAll(getAppearanceEntryDependencies(dic.getNormalAppearance(), baseNormal)); } COSBase baseRollover = dic.getCOSObject().getItem(COSName.R); if (baseRollover != null) { appearances.addAll(getAppearanceEntryDependencies(dic.getRolloverAppearance(), baseRollover)); } COSBase baseDown = dic.getCOSObject().getItem(COSName.D); if (baseDown != null) { appearances.addAll(getAppearanceEntryDependencies(dic.getDownAppearance(), baseDown)); } } return appearances; }
/** * Get the annotations down appearance. * * <p> * This will get the annotations down appearance. If this is not existent an * empty appearance entry will be created. * * @return the appearance entry representing the down appearance. */ PDAppearanceEntry getDownAppearance() { PDAppearanceDictionary appearanceDictionary = getAppearance(); PDAppearanceEntry appearanceEntry = appearanceDictionary.getDownAppearance(); if (appearanceEntry.isSubDictionary()) { appearanceEntry = new PDAppearanceEntry(new COSStream()); appearanceDictionary.setDownAppearance(appearanceEntry); } return appearanceEntry; }