public ASAtom getSubtype() { return getObject().getNameKey(ASAtom.SUBTYPE); }
private List<PDAction> getA() { org.verapdf.pd.actions.PDAction action = ((PDAnnotation) simplePDObject).getA(); if (action != null) { List<PDAction> res = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS); res.add(GFPDAction.getAction(action)); return Collections.unmodifiableList(res); } return Collections.emptyList(); }
@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; }
@Override public String getSubtype() { return annot == null || annot.empty() ? null : GFAdapterHelper.getStringFromASAtom(annot.getSubtype()); }
private List<PDContentStream> parseAppearance() { PDAppearanceEntry normalAppearance = ((PDAnnotation) simplePDObject).getNormalAppearance(); PDAppearanceEntry downAppearance = ((PDAnnotation) simplePDObject).getDownAppearance(); PDAppearanceEntry rolloverAppearance = ((PDAnnotation) simplePDObject).getRolloverAppearance(); if (normalAppearance != null || downAppearance != null || rolloverAppearance != null) { List<PDContentStream> appearances = new ArrayList<>(); addContentStreamsFromAppearanceEntry(normalAppearance, appearances); addContentStreamsFromAppearanceEntry(downAppearance, appearances); addContentStreamsFromAppearanceEntry(rolloverAppearance, appearances); return Collections.unmodifiableList(appearances); } return Collections.emptyList(); }
private Set<String> addAnnotsDependencies(PDPage page) { Set<String> annotsId = new HashSet<>(); for (PDAnnotation annot : page.getAnnotations()) { reportAnnotationActions(annot); String id = getId(annot.getObject(), FeatureObjectType.ANNOTATION); annotsId.add(id); if (checkIDBeforeProcess(id)) { PDAnnotation popup = annot.getPopup(); String popupID = null; if (popup != null) { popupID = addPopup(popup); } Set<String> formsIDs = getAnnotationResourcesDependencies(annot); popupID = config.isFeatureEnabled(FeatureObjectType.ANNOTATION) ? popupID : null; formsIDs = config.isAnyFeatureEnabled(XOBJECTS) ? formsIDs : null; reporter.report( GFFeaturesObjectCreator.createAnnotFeaturesObject(annot, id, popupID, formsIDs)); } } return annotsId; }
private void reportAnnotationActions(PDAnnotation annot) { if (config.isFeatureEnabled(FeatureObjectType.ACTION) && annot != null) { reportAction(annot.getA(), ActionFeaturesObjectAdapter.Location.ANNOTATION); PDAnnotationAdditionalActions additionalActions = annot.getAdditionalActions(); if (additionalActions != null) { reportAction(additionalActions.getBl(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getD(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getE(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getFo(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getPC(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getPI(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getPO(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getPV(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getU(), ActionFeaturesObjectAdapter.Location.ANNOTATION); reportAction(additionalActions.getX(), ActionFeaturesObjectAdapter.Location.ANNOTATION); } } }
@Override public Double getwidth() { return getDifference(((PDAnnotation) simplePDObject).getRect(), X_AXIS); }
@Override public String getSubtype() { ASAtom subtype = ((PDAnnotation) simplePDObject).getSubtype(); return subtype == null ? null : subtype.getValue(); }
@Override public String getN_type() { PDAppearanceEntry normalAppearance = ((PDAnnotation) simplePDObject).getNormalAppearance(); if (normalAppearance == null) { return null; } else if (normalAppearance.isSubDictionary()) { return DICT; } else { return STREAM; } }
private List<PDAction> getAdditionalActions() { PDAnnotationAdditionalActions additionalActions = ((PDAnnotation) simplePDObject).getAdditionalActions(); if (additionalActions != null) { List<PDAction> actions = new ArrayList<>(MAX_COUNT_OF_ACTIONS); org.verapdf.pd.actions.PDAction buffer; buffer = additionalActions.getBl(); this.addAction(actions, buffer); buffer = additionalActions.getD(); this.addAction(actions, buffer); buffer = additionalActions.getE(); this.addAction(actions, buffer); buffer = additionalActions.getFo(); this.addAction(actions, buffer); buffer = additionalActions.getPC(); this.addAction(actions, buffer); buffer = additionalActions.getPI(); this.addAction(actions, buffer); buffer = additionalActions.getPO(); this.addAction(actions, buffer); buffer = additionalActions.getPV(); this.addAction(actions, buffer); buffer = additionalActions.getU(); this.addAction(actions, buffer); buffer = additionalActions.getX(); this.addAction(actions, buffer); return Collections.unmodifiableList(actions); } return Collections.emptyList(); }
private static List<PDAppearanceStream> getAllAppearances(PDAnnotation annotation) { List<PDAppearanceStream> res = new ArrayList<>(); if (annotation != null) { addAllAppearances(annotation.getNormalAppearance(), res); addAllAppearances(annotation.getDownAppearance(), res); addAllAppearances(annotation.getRolloverAppearance(), res); } return res; }
@Override public Double getheight() { return getDifference(((PDAnnotation) simplePDObject).getRect(), Y_AXIS); }
private Set<String> getAnnotationResourcesDependencies(PDAnnotation annot) { Set<String> appearances = new HashSet<>(); PDAppearanceEntry normalAppearance = annot.getNormalAppearance(); if (normalAppearance != null) { appearances.addAll(getAppearanceEntryDependencies(normalAppearance)); } PDAppearanceEntry rolloverAppearance = annot.getRolloverAppearance(); if (rolloverAppearance != null) { appearances.addAll(getAppearanceEntryDependencies(rolloverAppearance)); } PDAppearanceEntry downAppearance = annot.getDownAppearance(); if (downAppearance != null) { appearances.addAll(getAppearanceEntryDependencies(downAppearance)); } return appearances; }
public Long getF() { return getObject().getIntegerKey(ASAtom.F); }
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; }
public Double getCA() { return getObject().getRealKey(ASAtom.CA); }
public ASAtom getFT() { Set<COSKey> visitedKeys = new HashSet<>(); COSObject curr = getObject(); while (curr != null && curr.getType().isDictionaryBased()) { COSKey key = curr.getObjectKey(); if (key != null) { if (visitedKeys.contains(key)) { throw new LoopedException("Loop in field tree"); } visitedKeys.add(key); } if (curr.knownKey(ASAtom.FT)) { return curr.getNameKey(ASAtom.FT); } curr = curr.getKey(ASAtom.PARENT); } return null; }
private String addPopup(PDAnnotation popup) { reportAnnotationActions(popup); String id = getId(popup.getObject(), FeatureObjectType.ANNOTATION); if (checkIDBeforeProcess(id)) { reporter.report(GFFeaturesObjectCreator.createAnnotFeaturesObject(popup, id, null, null)); } return id; }