Last active
September 20, 2023 18:05
-
-
Save documentprocessing/f243e74a3d92019f8fe97dfc608e9410 to your computer and use it in GitHub Desktop.
Convert HTML to PDF via Web URL and also with Inline CSS in Python using WeasyPrint Library. Check https://products.documentprocessing.com/conversion/python/weasyprint/ for more details.
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
// Import the HTML class from the WeasyPrint library | |
from weasyprint import HTML | |
// Instantiate HTML class and call write_pdf() method to convert Website URL to PDF | |
HTML('https://www.groupdocs.com/').write_pdf('groupdocs-weasyprint.pdf') |
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
// Import the HTML class from the WeasyPrint library | |
from weasyprint import HTML | |
// Instantiate HTML class. Call write_pdf() method to convert Website URL to PDF with Inline Stylesheet | |
HTML('https://www.groupdocs.com/').write_pdf('groupdocs-weasyprint.pdf', | |
stylesheets=[CSS(string='body { font-family: serif !important }')]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment