Convert
Convert()
Converts the loaded document to Markdown using default options and returns the result with the Markdown content in Content.
public ConvertResult Convert()
Return Value
A ConvertResult whose IsSuccess indicates whether the conversion succeeded. On success, Content contains the Markdown string.
Examples
using var converter = new MarkdownConverter("report.pdf");
ConvertResult result = converter.Convert();
if (result.IsSuccess)
File.WriteAllText("report.md", result.Content);
See Also
- class ConvertResult
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Convert(Stream)
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. |
Return Value
A ConvertResult indicating success or failure. On success, Content is null because the output was written to the stream.
See Also
- class ConvertResult
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Convert(string)
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. |
Return Value
A ConvertResult indicating success or failure. On success, Content is null because the output was written to the file.
See Also
- class ConvertResult
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Convert(ConvertOptions)
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. |
Return Value
A ConvertResult whose Content contains the Markdown string on success.
Examples
using var converter = new MarkdownConverter("document.docx");
var options = new ConvertOptions
{
HeadingLevelOffset = 1,
PageNumbers = new[] { 1, 2, 3 }
};
ConvertResult result = converter.Convert(options);
See Also
- class ConvertResult
- class ConvertOptions
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Convert(Stream, ConvertOptions)
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. |
Return Value
A ConvertResult indicating success or failure. Content is null because the output was written to the stream.
See Also
- class ConvertResult
- class ConvertOptions
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Convert(string, ConvertOptions)
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. |
Return Value
A ConvertResult indicating success or failure. Content is null because the output was written to the file.
Examples
using var converter = new MarkdownConverter("spreadsheet.xlsx");
var options = new ConvertOptions
{
ImageExportStrategy = new ExportImagesToFileSystemStrategy("images")
};
converter.Convert("output.md", options);
See Also
- class ConvertResult
- class ConvertOptions
- class MarkdownConverter
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown