--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/y73g4sctURs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from xhtml2pdf.pisa import CreatePDF
...
# Type is _io.BufferedWriter.
with open(pdf_pn, 'wb') as f_out: # type: BinaryIO
created_ok = CreatePDF(html, dest=f_out)
from io import BytesIO
from xhtml2pdf.pisa import CreatePDF
def show_pdf():
...
response.headers['Content-Type'] = 'application/pdf'
# Type is _io.BytesIO
in_mem_stream = BytesIO() # type: BytesIO
CreatePDF(html, dest=in_mem_stream)
pdf = in_mem_stream.getvalue() # type: bytes
in_mem_stream.close()
return pdf
from string import Template
...
html_part2 += Template(template).safe_substitute(fields_dic)
html = html_part1 + html_part2 + html_part3 # type: str
...
To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.