Created
December 13, 2020 22:40
-
-
Save farhan-raza/a7dda43cef8e255dc2ce4257648f2fc8 to your computer and use it in GitHub Desktop.
Convert Markdown (MD) to PDF or PNG, JPG Image Programmatically using C#
This file contains hidden or 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 hidden or 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