/** * Check if the Dest element is authorized according to the A entry * * @return if the Dest element is authorized according to the A entry. */ protected boolean checkDest() { try { if (this.pdLink.getDestination() != null && this.pdLink.getAction() != null) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_DEST, "Dest can't be used due to A element")); return false; } COSDictionary dict = pdLink.getCOSObject(); COSBase dest = dict.getDictionaryObject(COSName.DEST); if (dest != null) { ContextHelper.validateElement(ctx, dest, DESTINATION_PROCESS); } } catch (IOException e) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_INVALID_DEST, e.getMessage(), e)); return false; } return true; } }
private void processAnnotations(PDPage imported) throws IOException { List<PDAnnotation> annotations = imported.getAnnotations(); for (PDAnnotation annotation : annotations) { if (annotation instanceof PDAnnotationLink) { PDAnnotationLink link = (PDAnnotationLink)annotation; PDDestination destination = link.getDestination(); if (destination == null && link.getAction() != null) { PDAction action = link.getAction(); if (action instanceof PDActionGoTo) { destination = ((PDActionGoTo)action).getDestination(); } } if (destination instanceof PDPageDestination) { // TODO preserve links to pages within the splitted result ((PDPageDestination) destination).setPage(null); } } // TODO preserve links to pages within the splitted result annotation.setPage(null); } } /**
PDDestination pDestination = link.getDestination();
private void processAnnotations(PDPage imported) throws IOException { List<PDAnnotation> annotations = imported.getAnnotations(); for (PDAnnotation annotation : annotations) { if (annotation instanceof PDAnnotationLink) { PDAnnotationLink link = (PDAnnotationLink)annotation; PDDestination destination = link.getDestination(); if (destination == null && link.getAction() != null) { PDAction action = link.getAction(); if (action instanceof PDActionGoTo) { destination = ((PDActionGoTo)action).getDestination(); } } if (destination instanceof PDPageDestination) { // TODO preserve links to pages within the splitted result ((PDPageDestination) destination).setPage(null); } } // TODO preserve links to pages within the splitted result annotation.setPage(null); } }
private void processAnnotations(PDPage imported) throws IOException { List<PDAnnotation> annotations = imported.getAnnotations(); for (PDAnnotation annotation : annotations) { if (annotation instanceof PDAnnotationLink) { PDAnnotationLink link = (PDAnnotationLink)annotation; PDDestination destination = link.getDestination(); if (destination == null && link.getAction() != null) { PDAction action = link.getAction(); if (action instanceof PDActionGoTo) { destination = ((PDActionGoTo)action).getDestination(); } } if (destination instanceof PDPageDestination) { // TODO preserve links to pages within the splitted result ((PDPageDestination) destination).setPage(null); } } else { // TODO preserve links to pages within the splitted result annotation.setPage(null); } } }
private void processAnnotations(PDPage imported) throws IOException { List<PDAnnotation> annotations = imported.getAnnotations(); for (PDAnnotation annotation : annotations) { if (annotation instanceof PDAnnotationLink) { PDAnnotationLink link = (PDAnnotationLink)annotation; PDDestination destination = link.getDestination(); if (destination == null && link.getAction() != null) { PDAction action = link.getAction(); if (action instanceof PDActionGoTo) { destination = ((PDActionGoTo)action).getDestination(); } } if (destination instanceof PDPageDestination) { // TODO preserve links to pages within the splitted result ((PDPageDestination) destination).setPage(null); } } // TODO preserve links to pages within the splitted result annotation.setPage(null); } } /**
/** * Check if the Dest element is authorized according to the A entry * * @return if the Dest element is authorized according to the A entry. */ protected boolean checkDest() { try { if (this.pdLink.getDestination() != null && this.pdLink.getAction() != null) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_DEST, "Dest can't be used due to A element")); return false; } COSDictionary dict = pdLink.getCOSObject(); COSBase dest = dict.getDictionaryObject(COSName.DEST); if (dest != null) { ContextHelper.validateElement(ctx, dest, DESTINATION_PROCESS); } } catch (IOException e) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_INVALID_DEST, e.getMessage(), e)); return false; } return true; } }
/** * Check if the Dest element is authorized according to the A entry * * @return if the Dest element is authorized according to the A entry. */ protected boolean checkDest() { try { if (this.pdLink.getDestination() != null && this.pdLink.getAction() != null) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_FORBIDDEN_DEST, "Dest can't be used due to A element")); return false; } COSDictionary dict = pdLink.getCOSObject(); COSBase dest = dict.getDictionaryObject(COSName.DEST); if (dest != null) { ContextHelper.validateElement(ctx, dest, DESTINATION_PROCESS); } } catch (IOException e) { ctx.addValidationError(new ValidationError(ERROR_ANNOT_INVALID_DEST, e.getMessage(), e)); return false; } return true; } }
private void processAnnotations(PDPage imported) throws IOException { List<PDAnnotation> annotations = imported.getAnnotations(); for (PDAnnotation annotation : annotations) { if (annotation instanceof PDAnnotationLink) { PDAnnotationLink link = (PDAnnotationLink)annotation; PDDestination destination = link.getDestination(); if (destination == null && link.getAction() != null) { PDAction action = link.getAction(); if (action instanceof PDActionGoTo) { destination = ((PDActionGoTo)action).getDestination(); } } if (destination instanceof PDPageDestination) { // TODO preserve links to pages within the splitted result ((PDPageDestination) destination).setPage(null); } } // TODO preserve links to pages within the splitted result annotation.setPage(null); } } /**