This short tutorial briefs on how to transform MD to PDF in C#. It has the details to set the environment, a list of steps to develop the application, and a runnable sample code to export MD to PDF in C#. Different options will be discussed to customize the loading of the source MD file along with the options to set different properties of the output PDF file.
Steps to Convert MD File to PDF in C#
- Set the environment to use Aspose.PDF for .NET to change the MD file to PDF
- Instantiate an object of MdLoadOptions to customize the loading of the source MD file
- Instantiate the Document class object to load the MD file using the settings in the MdLoadOptions object
- Save the resultant PDF file on the disk with formatted contents from the MD file
These steps summarize the process of converting MD to PDF in C#. The MdLoadOptions class is used to customize the loading of the source MD file, however, we have used the default settings in the sample source code. The Document class has a constructor that is used to load the MD file along with the MdLoadOptions argument object containing the desired settings and the same Document object is used to save the output PDF file.
Code to Export MD File to PDF in C#
This sample code demonstrates the process of changing the source file format from MD to PDF in C#. It uses the MdLoadOptions class object that has the property to set a warning handler for the transformation. Once the MD file is loaded into the Document class object, you may set different properties like setting the PDF document title, removing metadata from the file, and encrypting the file.
This article has guided us to develop an MD to PDF converter in C#. If you want to learn the process to put page numbers, refer to the article on how to put page number in PDF using C#.