Created
March 28, 2018 01:33
-
-
Save olivx/bc2e34a2e1633ff7af3fdd58792e4bb1 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
# weasyprint | |
from weasyprint import HTML | |
context = {} | |
html_string = render_to_string('template.html', context=context, request=request) | |
html = HTML(string=html_string) | |
file_name = '%s.pdf' % obj.pk | |
pdf_path = os.path.join(settings.MEDIA_ROOT, 'resumes', file_name) | |
html.write_pdf(target=pdf_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment