Display PDF in browser

392 views
Skip to first unread message

Sana Javed

unread,
Jun 2, 2016, 2:39:29 PM6/2/16
to Wagtail support
Hi all,

Has anyone here found a workaround to display PDFs in the browser instead of them downloading by default? I came across this potential solution but we have documents in StreamField so that won't work for us. 

Thanks in advance!

Matthew Westcott

unread,
Jun 3, 2016, 4:39:31 AM6/3/16
to wag...@googlegroups.com
Hi Sana,
@chhantyal's workaround ought to work in any place you have a Document object, including inside a StreamField - can you give more details about why you think this won't work in your case?

(Is it because you're just outputting the StreamField in one go with {{ page.body }}, and never referring to the document directly in the template? If so, see http://docs.wagtail.io/en/v1.5/topics/streamfield.html#template-rendering for details of how to customise the rendering on a per-block basis.)

Cheers,
- Matt

Alex House

unread,
Jun 10, 2016, 4:56:44 AM6/10/16
to Wagtail support
Hi. I to make the icing on the pdf file to pdf.js when clicked - if any file is not downloaded, but simply open the file in the preview window.

https://github.com/andreasgal/pdf.js

пятница, 3 июня 2016 г., 4:39:29 UTC+10 пользователь Sana Javed написал:
Reply all
Reply to author
Forward
0 new messages