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());
annotator.getDocumentDataHandler();
InputStream cleanPdf = new FileInputStream("E:\Documents\input.pdf");
List<AnnotationInfo> annotations = new ArrayList<AnnotationInfo>();
// Point annotation
AnnotationInfo pointAnnotation = new AnnotationInfo();
pointAnnotation.setBox(new Rectangle(212f, 81f, 35f, 0.0f));
pointAnnotation.setPageNumber(0);
pointAnnotation.setType(AnnotationType.Point);
pointAnnotation.setCreatorName("Anonym A.");
annotations.add(pointAnnotation);
// Add annotation to the document
InputStream result = annotator.exportAnnotationsToDocument(cleanPdf, annotations, DocumentType.Pdf);
// Save result stream to file.
OutputStream fileStream = new FileOutputStream("E:\Documents\result.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.