Last active
April 9, 2025 13:45
-
-
Save venkata-qa/db1d17cd76e73283176bf2d82fbf1383 to your computer and use it in GitHub Desktop.
Revisions
-
venkata-qa revised this gist
Apr 9, 2025 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,3 +10,21 @@ # Convert HTML to PDF pdfkit.from_string(html, 'output.pdf') import markdown from weasyprint import HTML # Load your markdown file with open('file.md', 'r') as f: md_content = f.read() # Convert markdown to HTML html_content = markdown.markdown(md_content) # Generate PDF HTML(string=html_content).write_pdf("output.pdf") -
venkata-qa created this gist
Apr 9, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ import markdown import pdfkit # Read markdown content with open('file.md', 'r') as f: text = f.read() # Convert to HTML html = markdown.markdown(text) # Convert HTML to PDF pdfkit.from_string(html, 'output.pdf')