Created
October 7, 2014 17:46
-
-
Save acmisiti/5a3c5a8ae7a65923ea52 to your computer and use it in GitHub Desktop.
example rendering LATEX document to PDF
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 apps.staff.models import MHRBoxEmployee | |
employee = MHRBoxEmployee.objects.get(id=uid) | |
params = { | |
'employee' : employee, | |
} | |
# render the document with latex | |
tex_doc = render_to_string('tex/employee_agreement.tex', params) | |
(pdf, pdf_preview) = make_pdf(tex_doc) | |
# set document file name on s3 and upload to cloud | |
cloudname = "%s.pdf" % str(uuid.uuid4())[0:8] | |
s3_url = upload_document(path=os.path.abspath(os.path.join(settings.THECONTRACTBOX_DIR, pdf[1:])), doc_name=sloudname) | |
return s3_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment