Convert specific pages

GroupDocs.Markdown also provides the feature to convert selected page number.

To convert specific pages, follow these steps:

  1. Create an instance of MarkdownConverter class and pass source document path as a constructor parameter.
  2. Instantiate the appropriate DocumentConverterOptions class.
  3. Set the PageNumbers property of the DocumentConverterOptions instance to the list of desired page number to be converted.
  4. Call the Convert method of MarkdownConverter class instance and pass the filename of the converted document and the instance of DocumentConverterOptions from the previous steps.

The following code snippet shows how to convert first and third pages from the source document:

using (var converter = new MarkdownConverter("sample.docx"))
{
    var options = new DocumentConverterOptions
    {
        PageNumbers = new []{ 1, 3 }
    };
    converter.Convert("output.md", options);
}