Load document from local disk

When the source document is located on the local disk GroupDocs.Annotation allows you to load it via Annotator class constructor specifying absolute or relative path to it. For loading target document located on the local disk you should use add method that accepts absolute or relative path as parameter. 

Following code snippet shows how to load documents from local disk.

String outputPath = "LoadDocumentFromLocalDisk.pdf";

Annotator annotator = new Annotator("input.pdf");

AreaAnnotation area = new AreaAnnotation();
area.setBox(new Rectangle(100, 100, 100, 100));
area.setBackgroundColor(65535);

annotator.add(area);
annotator.save(outputPath);
annotator.dispose();

More resources

Advanced Usage Topics

To learn more about document annotating features, please refer to the advanced usage section.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured Java library we provide simple, but powerful free Apps.
You are welcome to annotate your PDF, DOC or DOCX, XLS or XLSX, PPT or PPTX, PNG and other documents with free to use online GroupDocs Annotation App.