Convert specific pages Leave feedback
GroupDocs.Conversion also provides the feature to convert selected page number.
Here are the steps to follow:
- Create new instance of Converter class and pass source document path as a constructor parameter
- Instantiate the proper ConvertOptions class e.g. (PdfConvertOptions, WordProcessingConvertOptions, SpreadsheetConvertOptions etc.)
- Set setPages property of the ConvertOptions instance with list of desired page number to be converted
- Call convert method of Converter class instance and pass filename for the converted document and the instance of ConvertOptions from the previous steps
Following code snippet shows how to convert first and third pages from the source document:
Converter converter = new Converter("sample.docx"); PdfConvertOptions options = new PdfConvertOptions(); options.setPages(Arrays.asList( 1, 3)); converter.convert("converted.pdf", options);
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.