コード例 #1
0
ファイル: views.py プロジェクト: jessesnyder/isaw.web
    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
コード例 #2
0
ファイル: views.py プロジェクト: isawnyu/isaw.facultycv
    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
コード例 #3
0
 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()
コード例 #4
0
 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()
コード例 #5
0
 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()