Convert N consecutive pages

GroupDocs.Conversion provides the feature to convert N consecutive pages. 

To convert consecutive pages, follow these steps:

  1. Create an instance of the Converter class and pass the source document path as a constructor parameter.
  2. Instantiate the appropriate ConvertOptions class e.g. (PdfConvertOptions, WordProcessingConvertOptions, SpreadsheetConvertOptions, etc.)
  3. Call the setPageNumber method of the ConvertOptions instance with the starting page number.
  4. Call the setPagesCount method of the ConvertOptions instance with the number of pages to be converted.
  5. Call the convert method of the Converter class instance and pass the filename of the converted document and the instance of ConvertOptions from the previous steps.

The following code snippet shows how to convert 3 consecutive pages starting from the second page of the source document:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
Converter converter = new Converter("sample.docx");
PdfConvertOptions options = new PdfConvertOptions();

converter.convert("converted.pdf", options);