Load document from stream

On this page

The following code snippet shows how to load a document from a stream:

// This example demonstrates loading document from stream.

// Create stream from inputPath
InputStream stream = new FileInputStream("inputPath");

// Create an instance of Annotator class
Annotator annotator = new Annotator(stream);
try {
    // Create an instance of AreaAnnotation class and set options
    AreaAnnotation area = new AreaAnnotation();
    area.setBox(new Rectangle(100, 100, 100, 100));
    // Add annotation and save to file
} finally {
    if (annotator != null) {

On this page