Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// For complete examples and data files, please go to
AnnotationImageHandler annotator = new AnnotationImageHandler(Utilities.getConfiguration());
InputStream inputStream = new FileInputStream("E:\sample.pdf");
List<AnnotationInfo> annotations = new ArrayList<AnnotationInfo>();
// Ellipse annotation
AnnotationInfo ellipseAnnotation = new AnnotationInfo();
ellipseAnnotation.setBox(new Rectangle(430f, 272f, 66f, 51f));
ellipseAnnotation.setCreatorName("Anonym A.");
// Add annotation to the document
InputStream result = annotator.exportAnnotationsToDocument(inputStream, annotations, DocumentType.Pdf);
// Save result stream to file.
OutputStream fileStream = new FileOutputStream("E:\annotated-ellipsed.pdf");
IOUtils.copy(result, fileStream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.