Save specific page range

On this page

To export the specific page range, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate the SaveOptions class. Call the setFirstPage and  setLastPage methods to specify the first and the last pages.
  3. Call the save() method with the output document path or stream. Specify the SaveOptions class as a parameter.

The following code demonstrates how to save the range of document page:

// This example demonstrates saving result document with specified pages.

// Create an instance of Annotator class
Annotator annotator = new Annotator("inputPath");
try {
    SaveOptions tmp0 = new SaveOptions();
    tmp0.setFirstPage(2);
    tmp0.setLastPage(4);
    
    // Save to file
    annotator.save(outputPath, tmp0);
} finally {
    if (annotator != null) {
        annotator.dispose();
    }
}

On this page