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 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.setCreatorName("Anonym A.");
// 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.