Am 06.06.2016 um 08:02 schrieb Krishnakant:
Then I would want an ajax call to get the pdf from that view callable.
So in the ajax call using jquery I can set application/pdf, but what
should I write in the renderer in view_config is my question.
And should I return the pdf as a value of a key in return?
You don't need a renderer, just pass the PDF as the body of a Response:
def pdf_view(request):
output = BytesIO()
doc = BaseDocTemplate(output, pagesize=...)
story = []
...
story.append(Paragraph(...))
...
doc.build(story)
body = output.getvalue()
output.close()
return Response(body=body, content_type='application/pdf',
content_disposition='inline; filename="myfile.pdf"')
I usually create a view class and use a method instead. Then you can add
helper methods to the same class, like onPage() and onPageEnd().
-- Christoph
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/3130415c-166c-6a09-36ec-4fad19832e79%40online.de.
For more options, visit https://groups.google.com/d/optout.