You can find all details at: Convert Markdown (MD) to PDF or PNG, JPG Image Programmatically using C#
Created
January 18, 2021 21:30
-
-
Save aspose-com-gists/5a5b5924357fd23d465d48f34d6268b0 to your computer and use it in GitHub Desktop.
Convert Markdown (MD) to PDF or PNG, JPG Image Programmatically using C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prepare a simple Markdown example | |
var code = "### Hello World" + | |
"\r\n" + | |
"[visit applications](https://.aspose.com)"; | |
// Create a Markdown file | |
System.IO.File.WriteAllText(dataDir + "document.md", code); | |
// Convert Markdown to HTML document | |
using (HTMLDocument document = Aspose.Html.Converters.Converter.ConvertMarkdown(dataDir + "document.md")) | |
{ | |
// Convert HTML document to PNG image file format | |
Aspose.Html.Converters.Converter.ConvertHTML(document, new Aspose.Html.Saving.ImageSaveOptions(Aspose.Html.Rendering.Image.ImageFormat.Png), dataDir + "output.png"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prepare a simple Markdown example | |
var code = "### Hello World" + | |
"\r\n" + | |
"[visit applications](https://aspose.com)"; | |
// Create a Markdown file | |
System.IO.File.WriteAllText(dataDir + "document.md", code); | |
// Convert Markdown to HTML document | |
//Aspose.Html.Converters.Converter.ConvertMarkdown("document.md", "document.html"); | |
HTMLDocument document = Aspose.Html.Converters.Converter.ConvertMarkdown(dataDir + "document.md"); | |
// Invoke the ConvertHTML method to convert the HTML to PDF. | |
Aspose.Html.Converters.Converter.ConvertHTML(document, new Aspose.Html.Saving.PdfSaveOptions(), dataDir + "output.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment