request = context.REQUEST templatename = 'default' report_tool = context.portal_report structuredString = context.text doc_xml = report_tool.convertSTX(structuredString) pdf = report_tool.renderPDF(templatename,doc_xml) request.RESPONSE.setHeader('Content-Type','application/pdf') request.RESPONSE.setHeader('Content-Length',len(pdf)) request.RESPONSE.setHeader('Content-Disposition','inline;filename=Myfile.pdf') return pdf