/** * This will return a list of appearances. In the case where there is only one appearance the map will contain one * entry whose key is the string "default". If there is no rollover appearance then the normal appearance will be * returned. Which means that this method will never return null. * * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs */ public PDAppearanceEntry getDownAppearance() { COSBase entry = dictionary.getDictionaryObject(COSName.D); if (entry instanceof COSDictionary) { return new PDAppearanceEntry((COSDictionary) entry); } else { return getNormalAppearance(); } }
/** * This will return a list of appearances. In the case where there is only one appearance the map will contain one * entry whose key is the string "default". If there is no rollover appearance then the normal appearance will be * returned. Which means that this method will never return null. * * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs */ public PDAppearanceEntry getRolloverAppearance() { COSBase entry = dictionary.getDictionaryObject(COSName.R); if (entry instanceof COSDictionary) { return new PDAppearanceEntry((COSDictionary) entry); } else { return getNormalAppearance(); } }
private String getOnValueForWidget(PDAnnotationWidget widget) { PDAppearanceDictionary apDictionary = widget.getAppearance(); if (apDictionary != null) { PDAppearanceEntry normalAppearance = apDictionary.getNormalAppearance(); if (normalAppearance != null) { Set<COSName> entries = normalAppearance.getSubDictionary().keySet(); for (COSName entry : entries) { if (COSName.Off.compareTo(entry) != 0) { return entry.getName(); } } } } return ""; }
if (apDictionary != null) PDAppearanceEntry normalAppearance = apDictionary.getNormalAppearance(); if (normalAppearance != null)
/** * Returns the appearance stream for this annotation, if any. The annotation state is taken into account, if * present. */ public PDAppearanceStream getNormalAppearanceStream() { PDAppearanceDictionary appearanceDict = getAppearance(); if (appearanceDict == null) { return null; } PDAppearanceEntry normalAppearance = appearanceDict.getNormalAppearance(); if (normalAppearance == null) { return null; } if (normalAppearance.isSubDictionary()) { COSName state = getAppearanceState(); return normalAppearance.getSubDictionary().get(state); } else { return normalAppearance.getAppearanceStream(); } }
/** * Get the annotations normal appearance. * * <p> * This will get the annotations normal appearance. If this is not existent * an empty appearance entry will be created. * * @return the appearance entry representing the normal appearance. */ private PDAppearanceEntry getNormalAppearance() { PDAppearanceDictionary appearanceDictionary = getAppearance(); PDAppearanceEntry normalAppearanceEntry = appearanceDictionary.getNormalAppearance(); if (normalAppearanceEntry.isSubDictionary()) { //TODO replace with "document.getDocument().createCOSStream()" normalAppearanceEntry = new PDAppearanceEntry(new COSStream()); appearanceDictionary.setNormalAppearance(normalAppearanceEntry); } return normalAppearanceEntry; }
private void updateByValue(String value) { getCOSObject().setName(COSName.V, value); // update the appearance state (AS) for (PDAnnotationWidget widget : getWidgets()) { if (widget.getAppearance() == null) { continue; } PDAppearanceEntry appearanceEntry = widget.getAppearance().getNormalAppearance(); if (((COSDictionary) appearanceEntry.getCOSObject()).containsKey(value)) { widget.setAppearanceState(value); } else { widget.setAppearanceState(COSName.Off.getName()); } } }
PDAppearanceEntry normalAppearance = ap.getNormalAppearance();
PDAppearanceEntry appearance = appearanceDict.getNormalAppearance();
private static String getN_type(PDAnnotation annot) { PDAppearanceDictionary appearanceDictionary = annot.getAppearance(); if (appearanceDictionary != null) { PDAppearanceEntry normalAppearance = appearanceDictionary.getNormalAppearance(); if (normalAppearance == null) { return null; } else if (normalAppearance.isSubDictionary()) { return DICT; } else { return STREAM; } } return null; }
/** * This will return a list of appearances. In the case where there is only one appearance the map will contain one * entry whose key is the string "default". If there is no rollover appearance then the normal appearance will be * returned. Which means that this method will never return null. * * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs */ public PDAppearanceEntry getDownAppearance() { COSBase entry = dictionary.getDictionaryObject(COSName.D); if (entry instanceof COSDictionary) { return new PDAppearanceEntry(entry); } else { return getNormalAppearance(); } }
/** * This will return a list of appearances. In the case where there is only one appearance the map will contain one * entry whose key is the string "default". If there is no rollover appearance then the normal appearance will be * returned. Which means that this method will never return null. * * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs */ public PDAppearanceEntry getDownAppearance() { COSBase entry = dictionary.getDictionaryObject(COSName.D); if (entry == null) { return getNormalAppearance(); } else { return new PDAppearanceEntry(entry); } }
/** * This will return a list of appearances. In the case where there is only one appearance the map will contain one * entry whose key is the string "default". If there is no rollover appearance then the normal appearance will be * returned. Which means that this method will never return null. * * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs */ public PDAppearanceEntry getRolloverAppearance() { COSBase entry = dictionary.getDictionaryObject(COSName.R); if (entry instanceof COSDictionary) { return new PDAppearanceEntry(entry); } else { return getNormalAppearance(); } }
/** * This will return a list of appearances. In the case where there is only one appearance the map will contain one * entry whose key is the string "default". If there is no rollover appearance then the normal appearance will be * returned. Which means that this method will never return null. * * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs */ public PDAppearanceEntry getRolloverAppearance() { COSBase entry = dictionary.getDictionaryObject(COSName.R); if (entry == null) { return getNormalAppearance(); } else { return new PDAppearanceEntry(entry); } }
private String getOnValueForWidget(PDAnnotationWidget widget) { PDAppearanceDictionary apDictionary = widget.getAppearance(); if (apDictionary != null) { PDAppearanceEntry normalAppearance = apDictionary.getNormalAppearance(); if (normalAppearance != null) { Set<COSName> entries = normalAppearance.getSubDictionary().keySet(); for (COSName entry : entries) { if (COSName.Off.compareTo(entry) != 0) { return entry.getName(); } } } } return ""; }
private String getOnValueForWidget(PDAnnotationWidget widget) { PDAppearanceDictionary apDictionary = widget.getAppearance(); if (apDictionary != null) { PDAppearanceEntry normalAppearance = apDictionary.getNormalAppearance(); if (normalAppearance != null) { Set<COSName> entries = normalAppearance.getSubDictionary().keySet(); for (COSName entry : entries) { if (COSName.Off.compareTo(entry) != 0) { return entry.getName(); } } } } return ""; }
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; }
private void updateByValue(String value) { getCOSObject().setName(COSName.V, value); // update the appearance state (AS) for (PDAnnotationWidget widget : getWidgets()) { PDAppearanceEntry appearanceEntry = widget.getAppearance().getNormalAppearance(); if (((COSDictionary) appearanceEntry.getCOSObject()).containsKey(value)) { widget.getCOSObject().setName(COSName.AS, value); } else { widget.getCOSObject().setItem(COSName.AS, COSName.Off); } } }
private void updateByValue(String value) throws IOException { getCOSObject().setName(COSName.V, value); // update the appearance state (AS) for (PDAnnotationWidget widget : getWidgets()) { if (widget.getAppearance() == null) { continue; } PDAppearanceEntry appearanceEntry = widget.getAppearance().getNormalAppearance(); if (((COSDictionary) appearanceEntry.getCOSObject()).containsKey(value)) { widget.setAppearanceState(value); } else { widget.setAppearanceState(COSName.Off.getName()); } } }