Skip to content

Instantly share code, notes, and snippets.

@berend
Created October 17, 2013 12:26
Show Gist options
  • Save berend/7024015 to your computer and use it in GitHub Desktop.
Save berend/7024015 to your computer and use it in GitHub Desktop.
Small python programm to reproduce https://github.com/Kozea/WeasyPrint/issues/128
from weasyprint import HTML
html_source ="""
<!DOCTYPE HTML>
<html>
<head>
<title>Weasy</title>
</head>
<body>
line 1<br>
line 2<br />
line3
</body>
</html>
"""
pdf_bytestring = HTML(string=html_source).write_pdf(target=None)
with open("/tmp/test.pdf", "w") as write_pdf:
write_pdf.write(pdf_bytestring)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment