Read all details at: Convert MD Markdown file to PDF or Image in Java
Last active
January 26, 2021 03:22
-
-
Save aspose-com-gists/b574e868e8f1a074e5cd113608184e3e to your computer and use it in GitHub Desktop.
Convert Markdown MD file to PDF or Image like PNG, JPG, TIFF
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
// Convert Markdown to HTML document | |
HTMLDocument document = Converter.convertMarkdown(dataDir + "document.md"); | |
try { | |
// Convert HTML document to PNG image file format | |
Converter.convertHTML( | |
document, | |
new ImageSaveOptions( | |
ImageFormat.Png | |
), | |
dataDir + "output_md.png" | |
); | |
} finally { | |
if (document != null) { | |
document.dispose(); | |
} | |
} |
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
// Load input MD file and Convert Markdown to HTML document | |
Converter.convertMarkdown(dataDir + "document.md", dataDir + "document.html"); | |
// Convert HTML file to output PDF file format | |
Converter.convertHTML(dataDir + "document.html", new PdfSaveOptions(), dataDir + "output_md.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment