Pandoc C#



Api

  1. Pandoc C# Version
  2. Pandoc C# Example
  3. Pandoc C# Document

In this article, we will be learning Markdown file to PDF, PNG, JPG, and other image formats conversion programmatically using C# language. MD files are quite common over the web and you might have noticed that readme files of different software, as well as the documentation, are often created in Markdown format. Let us take a look over the following headings:

Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of. .NET bindings to Pandoc. Contribute to t0yv0/libpandoc-dotnet development by creating an account on GitHub.

Markdown (.md) to PDF and Images Converter – API Installation

You need to install Aspose.HTML for .NET API for converting Markdown format files to PDF or image formats. You can configure the API by downloading it from the official Downloads section or via the NuGet gallery installation command, as under:

Convert Markdown (MD) to PDF Programmatically in C#

You can easily convert Markdown Files (MD) to PDF using C# programming language in your .NET applications. You need to follow the steps below for converting MD to PDF file:

  1. Prepare a simple Markdown example or load input MD file
  2. Call the ConvertMarkdown method
  3. Convert the input file to HTMLDocument instance
  4. Save the output PDF file using the ConvertHTML method

The following code shows how to convert markdown (MD) file to PDF using C#:

Api
View the code on Gist.

Convert Markdown (MD) to PNG or JPG Image Programmatically in C#

Sometimes you might need to preview an MD file so rendering it to an image can be helpful. You can convert MD file to PNG or JPG image as per your requirements. This conversion is basically a two-step approach where, first of all, you will render it to HTML format and then to an image:

Pandoc C# Version

  1. Create or Load the input Markdown (MD) file
  2. Convert the Markdown to intermediary HTML format
  3. Render the results to PNG or JPG output Image

These simple steps help you create an image of the MD file as a preview. You may utilize the output image further as per your use case. Moreover, the code below shows how to convert Markdown (MD) file to PNG or JPG Image in C#:

View the code on Gist.

Conclusion

Pandoc C# Example

To put it in a nutshell, we have considered the conversion of Markdown (MD) files using C# programming language in .NET Framework-based applications. These features can make your applications second to none. Furthermore, there are many other features offered by the API which you can explore by taking a look at Product Documentation. In case of any ambiguities or concerns, please feel free to write to us at Free Support Forum. We would love to have your feedback!

Pandoc C# Document

See Also