Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-Java
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.setPageNumber(0);
ellipseAnnotation.setType(AnnotationType.Ellipse);
ellipseAnnotation.setCreatorName("Anonym A.");
annotations.add(ellipseAnnotation);
// 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.