Convert N consecutive pages
Leave feedback
GroupDocs.Conversion provides the feature to convert N consecutive pages.
To convert consecutive pages, follow these steps:
- Create an instance of Converter class and pass source document path as a constructor parameter
- Instantiate the appropriate ConvertOptions class e.g. (PdfConvertOptions, WordProcessingConvertOptions, SpreadsheetConvertOptions etc.).
- Set the setPageNumber property of the ConvertOptions instance to the starting page number.
- Set the setPagesCount property of the ConvertOptions instance to the number of pages to be converted.
- Call the convert method of 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 second page of the source document:
const converter = new groupdocs.conversion.Converter('sample.docx')
const convertOptions = new groupdocs.conversion.PdfConvertOptions()
convertOptions.setPageNumber(2);
convertOptions.setPagesCount(2);
converter.convert('outputNPages.pdf', convertOptions)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.