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(); COSDictionary normalAppearanceDict = (COSDictionary) normalAppearance.getCOSObject(); normalAppearanceDict.setItem(COSName.Off, createRadioButtonAppearanceStream(document, widget, false)); normalAppearanceDict.setItem(COSName.YES, createRadioButtonAppearanceStream(document, widget, true));
private Set<String> getAppearanceEntryDependencies(PDAppearanceEntry entry, COSBase entryLink) { Set<String> res = new HashSet<>(); if (entry.isStream()) { res.add(getAppearanceStreamDependencies(entry.getAppearanceStream(), entryLink)); } else { for (Map.Entry<COSName, PDAppearanceStream> mapEntry : entry.getSubDictionary().entrySet()) { res.add(getAppearanceStreamDependencies(mapEntry.getValue(), ((COSDictionary) entry.getCOSObject()).getItem(mapEntry.getKey()))); } } return res; }
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()); } } }