Skip to content

Instantly share code, notes, and snippets.

@acmisiti
Created October 7, 2014 17:46
Show Gist options
  • Save acmisiti/5a3c5a8ae7a65923ea52 to your computer and use it in GitHub Desktop.
Save acmisiti/5a3c5a8ae7a65923ea52 to your computer and use it in GitHub Desktop.
example rendering LATEX document to PDF
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