Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active November 29, 2019 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/5d1b0f63bcf950e2d553c50c2a853fdf to your computer and use it in GitHub Desktop.
Save GroupDocsGists/5d1b0f63bcf950e2d553c50c2a853fdf to your computer and use it in GitHub Desktop.
// 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