Converting a document from Markdown to PDF format
This guide demonstrates how to convert Markdown files to PDF format using Nutrient .NET SDK, preserving document structure and formatting.
Markdown is a supported import format in GdPicture. You can load Markdown files similar to any other document format and convert them to PDF, render them as images, or display them in a viewer. The Markdown import support handles standard Markdown syntax including headers, lists, code blocks, tables, and inline formatting.
Preparing the project
Register your license key to initialize the SDK. This only needs to happen once when your application starts, before any conversion operations. Refer to the getting started with .NET SDK guide for more details.
using GdPicture14;
LicenseManager licence = new LicenseManager();licence.RegisterKEY(""); // Set your license keyThe LicenseManager handles SDK authentication, enabling access to all document processing features including Markdown import capability.
Loading the Markdown document
Load the Markdown file using the document converter, specifying the Markdown format explicitly.
using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();converter.LoadFromFile(@"input.md", DocumentFormat.DocumentFormatMD);The GdPictureDocumentConverter treats Markdown as a first-class document format. By specifying DocumentFormat.DocumentFormatMD, the converter parses the Markdown syntax and prepares it for conversion or rendering operations.
Converting to PDF format
Convert the loaded Markdown content to PDF using the standard conversion method.
converter.SaveAsPDF(@"output.pdf");The SaveAsPDF method renders the Markdown structure into formatted PDF content, applying styling to headers, lists, code blocks, and other elements while preserving document hierarchy.
Conclusion
That’s all it takes to convert a Markdown file to PDF! Once loaded, Markdown documents can be converted to PDF, rendered as images, or processed using the complete range of SDK capabilities.
 
  
  
  
 