def __call__(self): response = self.request.response title = self.context.Title() ftitle = "/tmp/%s_CV.pdf" % (title) filename = ftitle attachment = 'attachment; filename=%s' % (ftitle) f = file(filename, "wb") pdf_template = ViewPageTemplateFile('templates/pdf-view.pt')(self) response.setHeader('Content-Type', 'application/pdf') response.setHeader('Content-Disposition', attachment) pdf = pisa.CreatePDF(pdf_template.encode("UTF-8"), response) f.flush() f.close() if not pdf.err: return response else: # Something is wrong # Fledge this out later pass
def __call__(self): response = self.request.response title = self.context.Title() ftitle = "/tmp/%s_CV.pdf" % (title) filename = ftitle attachment = 'attachment; filename=%s' % (ftitle) f = file(filename, "wb") pdf_template = ViewPageTemplateFile('templates/pdf-view.pt')(self) response.setHeader('Content-Type', 'application/pdf') response.setHeader('Content-Disposition', attachment); pdf = pisa.CreatePDF(pdf_template.encode("UTF-8"), response) f.flush() f.close() if not pdf.err: return response else: # Something is wrong # Fledge this out later pass
def __call__(self): self.request.response.setHeader('content-type', 'application/pdf') rml_doc = ViewPageTemplateFile('print_survey.pt')(self) return parseString(rml_doc.encode('utf-8')).read()
def __call__(self): self.request.response.setHeader("content-type", "application/pdf") rml_doc = ViewPageTemplateFile("print_survey.pt")(self) return parseString(rml_doc.encode("utf-8")).read()