MarkdownToPdf is a .NET library serving as a converter of markdown text to PDF. It supports fully customizable styling via cascading styles, page setup, headers and footers, page numbering, sections, page and sections breaks and it also supports plugins for features like syntax highlighting or for displaying mathematical expressions. Technically it uses markdig library to parse the markdown document an Pdfsharp/Migradoc library to render the output.
- basic and github markdown
- Pipe tables
- Grid tables
- Extra emphasis (strike through ~~,Subscript ~ Superscript ^ Inserted ++ Marked ==)
- Special attributes for applying styles and formatting
- Footnotes
- Task Lists
- Citation text by enclosing ""...""
- Custom containers similar to fenced code block :::
- Mathematics/Latex extension by enclosing $$ for block and $ for inline math
- SmartyPants
For details, see markdig documentation and this project documentation.
The basic usage is pretty straightforward:
- create an instance of
MarkdownToPdf
- optionally set-up the page layout
- optionally modify or add styles
- add the markdown text
- save
E.g.:
var pdf = new MarkdownToPdf();
pdf
.Add("# Hello, Wolrd")
.Save("output.pdf");
Please see the documentation for more information. Here are some sample PDF outputs:
The library is available as a NuGet package:
MarkdownToPdf.SyntaxHighlighter based on PrismSharp currently supports over 270 programming languages and has 44 built in visual themes
This software is released under the MIT license.