PDAnnotationAdditionalActions annotationActions = new PDAnnotationAdditionalActions(); annotationActions.setE(jsEnterAction); annotationActions.setX(jsExitAction); annotationActions.setD(jsMouseDownAction); annotationActions.setU(jsMouseUpAction); annotationActions.setFo(jsFocusAction); annotationActions.setBl(jsBlurredAction);
private void handleWidget(PDAnnotationWidget widget) throws TikaException, SAXException, IOException { if (widget == null) { return; } handleDestinationOrAction(widget.getAction(), ActionTrigger.ANNOTATION_WIDGET); PDAnnotationAdditionalActions annotationActions = widget.getActions(); if (annotationActions != null) { handleDestinationOrAction(annotationActions.getBl(), ActionTrigger.ANNOTATION_LOSE_INPUT_FOCUS); handleDestinationOrAction(annotationActions.getD(), ActionTrigger.ANNOTATION_MOUSE_CLICK); handleDestinationOrAction(annotationActions.getE(), ActionTrigger.ANNOTATION_CURSOR_ENTERS); handleDestinationOrAction(annotationActions.getFo(), ActionTrigger.ANNOTATION_RECEIVES_FOCUS); handleDestinationOrAction(annotationActions.getPC(), ActionTrigger.ANNOTATION_PAGE_CLOSED); handleDestinationOrAction(annotationActions.getPI(), ActionTrigger.ANNOTATION_PAGE_NO_LONGER_VISIBLE); handleDestinationOrAction(annotationActions.getPO(), ActionTrigger.ANNOTATION_PAGE_OPENED); handleDestinationOrAction(annotationActions.getPV(), ActionTrigger.ANNOTATION_PAGE_VISIBLE); handleDestinationOrAction(annotationActions.getU(), ActionTrigger.ANNOTATION_MOUSE_RELEASED); handleDestinationOrAction(annotationActions.getX(), ActionTrigger.ANNOTATION_CURSOR_EXIT); } }
if (annotationAdditionalActions.getBl() != null) { LOGGER.debug( "Found&Removed action on annotation widget to be performed when the annotation loses the input focus, was {}", annotationAdditionalActions.getBl()); pdfBleachSession .recordJavascriptThreat("Annotation", "Action when annotation loses the input focus"); annotationAdditionalActions.setBl(null); if (annotationAdditionalActions.getD() != null) { LOGGER.debug( "Found&Removed action on annotation widget to be performed when the mouse button is pressed inside the annotation's active area, was {}", annotationAdditionalActions.getD()); annotationAdditionalActions.setD(null); pdfBleachSession.recordJavascriptThreat( "Annotation", "Action when mouse button is pressed inside the annotation's active area"); if (annotationAdditionalActions.getE() != null) { LOGGER.debug( "Found&Removed action on annotation widget to be performed when the cursor enters the annotation's active area, was {}", annotationAdditionalActions.getE()); annotationAdditionalActions.setE(null); pdfBleachSession.recordJavascriptThreat( "Annotation", "Action when the cursor enters the annotation's active area"); if (annotationAdditionalActions.getFo() != null) { LOGGER.debug( "Found&Removed action on annotation widget to be performed when the annotation receives the input focus, was {}", annotationAdditionalActions.getFo());
PDAnnotationAdditionalActions tfAction = new PDAnnotationAdditionalActions(); tfAction.setU(tfJs); button.getWidgets().get(0).setActions(tfAction);
/** * Get the additional actions for this field. This will return null if there are no additional actions for this * field. As of PDF 1.6 this is only used for Widget Annotations. * * @return The actions of the field. */ public PDAnnotationAdditionalActions getActions() { COSBase base = this.getCOSObject().getDictionaryObject(COSName.AA); if (base instanceof COSDictionary) { return new PDAnnotationAdditionalActions((COSDictionary) base); } return null; }
PDAnnotationAdditionalActions tfAction = new PDAnnotationAdditionalActions(); tfAction.setU(tfJs); button.getWidget().setActions(tfAction);
/** * Get the additional actions for this field. This will return null if there are no additional actions for this * field. As of PDF 1.6 this is only used for Widget Annotations. * * @return The actions of the field. */ public PDAnnotationAdditionalActions getActions() { COSBase base = this.getCOSObject().getDictionaryObject(COSName.AA); if (base instanceof COSDictionary) { return new PDAnnotationAdditionalActions((COSDictionary) base); } return null; }
private void handleWidget(PDAnnotationWidget widget) throws TikaException, SAXException, IOException { if (widget == null) { return; } handleDestinationOrAction(widget.getAction(), ActionTrigger.ANNOTATION_WIDGET); PDAnnotationAdditionalActions annotationActions = widget.getActions(); if (annotationActions != null) { handleDestinationOrAction(annotationActions.getBl(), ActionTrigger.ANNOTATION_LOSE_INPUT_FOCUS); handleDestinationOrAction(annotationActions.getD(), ActionTrigger.ANNOTATION_MOUSE_CLICK); handleDestinationOrAction(annotationActions.getE(), ActionTrigger.ANNOTATION_CURSOR_ENTERS); handleDestinationOrAction(annotationActions.getFo(), ActionTrigger.ANNOTATION_RECEIVES_FOCUS); handleDestinationOrAction(annotationActions.getPC(), ActionTrigger.ANNOTATION_PAGE_CLOSED); handleDestinationOrAction(annotationActions.getPI(), ActionTrigger.ANNOTATION_PAGE_NO_LONGER_VISIBLE); handleDestinationOrAction(annotationActions.getPO(), ActionTrigger.ANNOTATION_PAGE_OPENED); handleDestinationOrAction(annotationActions.getPV(), ActionTrigger.ANNOTATION_PAGE_VISIBLE); handleDestinationOrAction(annotationActions.getU(), ActionTrigger.ANNOTATION_MOUSE_RELEASED); handleDestinationOrAction(annotationActions.getX(), ActionTrigger.ANNOTATION_CURSOR_EXIT); } }
PDAnnotationAdditionalActions annotationActions = new PDAnnotationAdditionalActions(); annotationActions.setE(jsEnterAction); annotationActions.setX(jsExitAction); annotationActions.setD(jsMouseDownAction); annotationActions.setU(jsMouseUpAction); annotationActions.setFo(jsFocusAction); annotationActions.setBl(jsBlurredAction);
/** * Get the additional actions for this field. This will return null if there are no additional actions for this * field. As of PDF 1.6 this is only used for Widget Annotations. * * @return The actions of the field. */ public PDAnnotationAdditionalActions getActions() { COSBase base = this.getCOSObject().getDictionaryObject(COSName.AA); if (base instanceof COSDictionary) { return new PDAnnotationAdditionalActions((COSDictionary) base); } return null; }
private void handleWidget(PDAnnotationWidget widget) throws TikaException, SAXException, IOException { if (widget == null) { return; } handleDestinationOrAction(widget.getAction(), ActionTrigger.ANNOTATION_WIDGET); PDAnnotationAdditionalActions annotationActions = widget.getActions(); if (annotationActions != null) { handleDestinationOrAction(annotationActions.getBl(), ActionTrigger.ANNOTATION_LOSE_INPUT_FOCUS); handleDestinationOrAction(annotationActions.getD(), ActionTrigger.ANNOTATION_MOUSE_CLICK); handleDestinationOrAction(annotationActions.getE(), ActionTrigger.ANNOTATION_CURSOR_ENTERS); handleDestinationOrAction(annotationActions.getFo(), ActionTrigger.ANNOTATION_RECEIVES_FOCUS); handleDestinationOrAction(annotationActions.getPC(), ActionTrigger.ANNOTATION_PAGE_CLOSED); handleDestinationOrAction(annotationActions.getPI(), ActionTrigger.ANNOTATION_PAGE_NO_LONGER_VISIBLE); handleDestinationOrAction(annotationActions.getPO(), ActionTrigger.ANNOTATION_PAGE_OPENED); handleDestinationOrAction(annotationActions.getPV(), ActionTrigger.ANNOTATION_PAGE_VISIBLE); handleDestinationOrAction(annotationActions.getU(), ActionTrigger.ANNOTATION_MOUSE_RELEASED); handleDestinationOrAction(annotationActions.getX(), ActionTrigger.ANNOTATION_CURSOR_EXIT); } }
private void handleWidget(PDAnnotationWidget widget) throws TikaException, SAXException, IOException { if (widget == null) { return; } handleDestinationOrAction(widget.getAction(), ActionTrigger.ANNOTATION_WIDGET); PDAnnotationAdditionalActions annotationActions = widget.getActions(); if (annotationActions != null) { handleDestinationOrAction(annotationActions.getBl(), ActionTrigger.ANNOTATION_LOSE_INPUT_FOCUS); handleDestinationOrAction(annotationActions.getD(), ActionTrigger.ANNOTATION_MOUSE_CLICK); handleDestinationOrAction(annotationActions.getE(), ActionTrigger.ANNOTATION_CURSOR_ENTERS); handleDestinationOrAction(annotationActions.getFo(), ActionTrigger.ANNOTATION_RECEIVES_FOCUS); handleDestinationOrAction(annotationActions.getPC(), ActionTrigger.ANNOTATION_PAGE_CLOSED); handleDestinationOrAction(annotationActions.getPI(), ActionTrigger.ANNOTATION_PAGE_NO_LONGER_VISIBLE); handleDestinationOrAction(annotationActions.getPO(), ActionTrigger.ANNOTATION_PAGE_OPENED); handleDestinationOrAction(annotationActions.getPV(), ActionTrigger.ANNOTATION_PAGE_VISIBLE); handleDestinationOrAction(annotationActions.getU(), ActionTrigger.ANNOTATION_MOUSE_RELEASED); handleDestinationOrAction(annotationActions.getX(), ActionTrigger.ANNOTATION_CURSOR_EXIT); } }
PDAnnotationAdditionalActions additionalActions = new PDAnnotationAdditionalActions( (COSDictionary) actionDictionary); org.apache.pdfbox.pdmodel.interactive.action.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();