Convert
Leave feedback
On this page
Converts the loaded document to Markdown using default options and returns the result with the Markdown content in Content.
public ConvertResult Convert()
A ConvertResult whose IsSuccess indicates whether the conversion succeeded. On success, Content contains the Markdown string.
using var converter = new MarkdownConverter("report.pdf");
ConvertResult result = converter.Convert();
if (result.IsSuccess)
File.WriteAllText("report.md", result.Content);
- class ConvertResult
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Converts the loaded document to Markdown and writes the output to the specified stream. The Content property will be null; the Markdown bytes are written directly to outputStream.
public ConvertResult Convert(Stream outputStream)
| Parameter | Type | Description |
|---|---|---|
| outputStream | Stream | A writable stream that will receive the UTF-8 encoded Markdown output. |
A ConvertResult indicating success or failure. On success, Content is null because the output was written to the stream.
- class ConvertResult
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Converts the loaded document to Markdown and saves the result to a file. The file is created (or overwritten) at outputFilePath.
public ConvertResult Convert(string outputFilePath)
| Parameter | Type | Description |
|---|---|---|
| outputFilePath | String | The path where the Markdown file will be written. |
A ConvertResult indicating success or failure. On success, Content is null because the output was written to the file.
- class ConvertResult
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Converts the loaded document to Markdown with the specified options and returns the result with the Markdown content in Content.
public ConvertResult Convert(ConvertOptions convertOptions)
| Parameter | Type | Description |
|---|---|---|
| convertOptions | ConvertOptions | Options that control the conversion, such as HeadingLevelOffset, ImageExportStrategy, and PageNumbers. Pass null to use defaults. |
A ConvertResult whose Content contains the Markdown string on success.
using var converter = new MarkdownConverter("document.docx");
var options = new ConvertOptions
{
HeadingLevelOffset = 1,
PageNumbers = new[] { 1, 2, 3 }
};
ConvertResult result = converter.Convert(options);
- class ConvertResult
- class ConvertOptions
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Converts the loaded document to Markdown with the specified options, writing the output to a stream.
public ConvertResult Convert(Stream outputStream, ConvertOptions convertOptions)
| Parameter | Type | Description |
|---|---|---|
| outputStream | Stream | A writable stream that will receive the UTF-8 encoded Markdown output. |
| convertOptions | ConvertOptions | Options that control the conversion. Pass null to use defaults. |
A ConvertResult indicating success or failure. Content is null because the output was written to the stream.
- class ConvertResult
- class ConvertOptions
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Converts the loaded document to Markdown with the specified options and saves the result to a file. The file is created (or overwritten) at outputFilePath.
public ConvertResult Convert(string outputFilePath, ConvertOptions convertOptions)
| Parameter | Type | Description |
|---|---|---|
| outputFilePath | String | The path where the Markdown file will be written. |
| convertOptions | ConvertOptions | Options that control the conversion. Pass null to use defaults. |
A ConvertResult indicating success or failure. Content is null because the output was written to the file.
using var converter = new MarkdownConverter("spreadsheet.xlsx");
var options = new ConvertOptions
{
ImageExportStrategy = new ExportImagesToFileSystemStrategy("images")
};
converter.Convert("output.md", options);
- class ConvertResult
- class ConvertOptions
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
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.