handleDestinationOrAction(additionalActions.getDP(), ActionTrigger.AFTER_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getDS(), ActionTrigger.AFTER_DOCUMENT_SAVE); handleDestinationOrAction(additionalActions.getWC(), ActionTrigger.BEFORE_DOCUMENT_CLOSE); handleDestinationOrAction(additionalActions.getWP(), ActionTrigger.BEFORE_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getWS(), ActionTrigger.BEFORE_DOCUMENT_SAVE); xhtml.endDocument(); } catch (TikaException e) {
/** * @return The Additional Actions for this Document */ public PDDocumentCatalogAdditionalActions getActions() { COSDictionary addAction = (COSDictionary) root.getDictionaryObject(COSName.AA); if (addAction == null) { addAction = new COSDictionary(); root.setItem(COSName.AA, addAction); } return new PDDocumentCatalogAdditionalActions(addAction); }
void sanitizeDocumentActions(PDDocumentCatalogAdditionalActions documentActions) { LOGGER.trace("Checking additional actions..."); if (documentActions.getDP() != null) { LOGGER.debug("Found&removed action after printing (was {})", documentActions.getDP()); documentActions.setDP(null); pdfBleachSession .recordJavascriptThreat("DocumentCatalogAdditionalActions", "Action after printing"); if (documentActions.getDS() != null) { LOGGER.debug("Found&removed action after saving (was {})", documentActions.getDS()); documentActions.setDS(null); pdfBleachSession .recordJavascriptThreat("DocumentCatalogAdditionalActions", "Action after saving"); if (documentActions.getWC() != null) { LOGGER.debug("Found&removed action before closing (was {}", documentActions.getWC()); documentActions.setWC(null); pdfBleachSession .recordJavascriptThreat("DocumentCatalogAdditionalActions", "Action before closing"); if (documentActions.getWP() != null) { LOGGER.debug("Found&removed action before printing (was {})", documentActions.getWP()); documentActions.setWP(null); pdfBleachSession .recordJavascriptThreat("DocumentCatalogAdditionalActions", "Action before printing"); if (documentActions.getWS() != null) { LOGGER.debug("Found&removed action before saving (was {})", documentActions.getWS()); documentActions.setWS(null); pdfBleachSession
private List<PDAction> getActions() { PDDocumentCatalogAdditionalActions pbActions = this.getAdditionalAction(); if (pbActions != null) { List<PDAction> actions = new ArrayList<>(MAX_NUMBER_OF_ACTIONS); org.apache.pdfbox.pdmodel.interactive.action.PDAction buffer; buffer = pbActions.getDP(); this.addAction(actions, buffer); buffer = pbActions.getDS(); this.addAction(actions, buffer); buffer = pbActions.getWP(); this.addAction(actions, buffer); buffer = pbActions.getWS(); this.addAction(actions, buffer); buffer = pbActions.getWC(); this.addAction(actions, buffer); return Collections.unmodifiableList(actions); } return Collections.emptyList(); }
private PDDocumentCatalogAdditionalActions getAdditionalAction() { if (this.catalog != null) { COSDictionary catalogLocal = this.catalog.getCOSObject(); COSBase aaDictionary = catalogLocal.getDictionaryObject(COSName.AA); if (aaDictionary instanceof COSDictionary) { return new PDDocumentCatalogAdditionalActions((COSDictionary) aaDictionary); } } return null; }
handleDestinationOrAction(additionalActions.getDP(), ActionTrigger.AFTER_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getDS(), ActionTrigger.AFTER_DOCUMENT_SAVE); handleDestinationOrAction(additionalActions.getWC(), ActionTrigger.BEFORE_DOCUMENT_CLOSE); handleDestinationOrAction(additionalActions.getWP(), ActionTrigger.BEFORE_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getWS(), ActionTrigger.BEFORE_DOCUMENT_SAVE); xhtml.endDocument(); } catch (TikaException e) {
/** * @return The Additional Actions for this Document */ public PDDocumentCatalogAdditionalActions getActions() { COSDictionary addAction = (COSDictionary) root.getDictionaryObject(COSName.AA); if (addAction == null) { addAction = new COSDictionary(); root.setItem(COSName.AA, addAction); } return new PDDocumentCatalogAdditionalActions(addAction); }
handleDestinationOrAction(additionalActions.getDP(), ActionTrigger.AFTER_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getDS(), ActionTrigger.AFTER_DOCUMENT_SAVE); handleDestinationOrAction(additionalActions.getWC(), ActionTrigger.BEFORE_DOCUMENT_CLOSE); handleDestinationOrAction(additionalActions.getWP(), ActionTrigger.BEFORE_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getWS(), ActionTrigger.BEFORE_DOCUMENT_SAVE); xhtml.endDocument(); } catch (TikaException e) {
/** * @return The Additional Actions for this Document */ public PDDocumentCatalogAdditionalActions getActions() { COSDictionary addAction = (COSDictionary) root.getDictionaryObject(COSName.AA); if (addAction == null) { addAction = new COSDictionary(); root.setItem(COSName.AA, addAction); } return new PDDocumentCatalogAdditionalActions(addAction); }
handleDestinationOrAction(additionalActions.getDP(), ActionTrigger.AFTER_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getDS(), ActionTrigger.AFTER_DOCUMENT_SAVE); handleDestinationOrAction(additionalActions.getWC(), ActionTrigger.BEFORE_DOCUMENT_CLOSE); handleDestinationOrAction(additionalActions.getWP(), ActionTrigger.BEFORE_DOCUMENT_PRINT); handleDestinationOrAction(additionalActions.getWS(), ActionTrigger.BEFORE_DOCUMENT_SAVE); xhtml.endDocument(); } catch (TikaException e) {