You could show the pdf in a frame o open it a new tab (depends of the use case)
On Thursday, September 24, 2020 at 11:13:53 AM UTC-5 [email protected] wrote: > Thank you > note my controller has to return several data too > the page html displayed by this controllers displays pics , link to pdf ... > How can i do ? > thank you > > Le jeu. 24 sept. 2020 à 17:10, Clemens <[email protected]> a > écrit : > >> Have a try! >> >> response.title = 'Your Document Title' >> response.headers['Content-Type'] = 'application/pdf' >> response.headers['Content-Disposition']='inline' >> >> return response.stream(<location of PDF file to be streamed>) >> >> I prefer the user to decide what to do (save or view in default browser) >> by >> response.title = 'Your Document Title' >> response.headers['Content-Type'] = 'application/pdf' >> response.headers['Content-Disposition']='attachment; filename= >> {}.pdf'.format(request.vars.filename) >> >> return response.stream(<location of PDF file to be streamed>) >> >> Best regards >> Clemens >> >> On Thursday, September 24, 2020 at 4:54:53 PM UTC+2 [email protected] >> wrote: >> >>> Hi, >>> i have a controller with this : >>> response.headers['Content-Disposition'] = 'inline; filename=%s' % >>> request.vars.filename >>> >>> to force streaming the pdf file , and i do not why it does not work .. >>> any idea ? >>> >>> Thank you >>> >>> >>> >> -- >> 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/F7nWHxb_6OI/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/a5acb3fc-db71-4a9e-b94a-0ada13caf029n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/a5acb3fc-db71-4a9e-b94a-0ada13caf029n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > > *Laurent Chambon* > *47 rue Pougnet* > *33400 Talence* > > *06 64 13 71 16 * > -- 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 the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/fe4ff9b9-d493-4f14-a8d1-91c225913149n%40googlegroups.com.

