Convert to WordProcessing with advanced options

GroupDocs.Conversion provides the WordProcessingConvertOptions class to give you control over the results when converting to word-processing formats. Along with common convert options from the base class, the WordProcessingConvertOptions has the following additional options:

  • setFormat specifies desired result document type. Available options are: Doc, Docm, Docx, Dot, Dotx, Rtf, Odt, Ott, Mobi, Txt.
  • setWidth specifies desired page width after conversion.
  • setHeight -  desired page height after conversion.
  • setDpi specifies desired page dpi after conversion.
  • setPassword whether the converted document will be password-protected with the specified password.
  • setRtfOptions specifies RTF-specific options. RtfOptions class has a single option: setExportImagesForOldReaders specifies whether the keywords for “old readers” are written to RTF or not. This can significantly affect the size of the RTF document.
  • setZoom - specifies the zoom level in percentage.

The following code snippet shows how to convert to a word-processing document with advanced options:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.filetypes.WordProcessingFileType;
import com.groupdocs.conversion.options.convert.WordProcessingConvertOptions;
...
Converter converter = new Converter("sample.pdf");

WordProcessingConvertOptions options = new WordProcessingConvertOptions();
options.setPageNumber(2);
options.setPagesCount(1);
options.setFormat(WordProcessingFileType.Odt);
converter.convert("converted.odt", options);