Created
February 20, 2018 11:25
-
-
Save mertsalik/251874fa92ec5a0f35799b349da8f0dc to your computer and use it in GitHub Desktop.
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
from weasyprint import HTML | |
from io import BytesIO | |
def convert_html_to_pdf(html_string): | |
""" | |
:param html_string: rendered invoice html | |
:return: bytes array | |
""" | |
with BytesIO() as byte_io: | |
HTML(string=html_string).write_pdf(byte_io) | |
return byte_io.getValue() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment