# PDF viewer doesn't display the PDF file

**URL:** <https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497>\
**Category:** Ask us anything\
**Created:** [March 28, 2025, 4:40pm UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497 "2025-03-28T16:40:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![flycode](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@flycode](https://community.weweb.io/u/flycode)\
**Post date:** [March 28, 2025, 4:40pm UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497/1 "2025-03-28T16:40:50Z")

</div>

Hello Eveyrone,

I use the PDF viewer element and when I enter the URI of my PDF, it downloads it instead of displaying it.

Seems like it comes from my URI as the sample URL provided with the element displays the PDF without problem, but I can’t figure out what is the problem.

Does someone know what could be causing this issue ?

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![DanielL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/daniell/32/13398_2.png) [@DanielL](https://community.weweb.io/u/DanielL)\
**Post date:** [April 2, 2025, 11:38am UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497/2 "2025-04-02T11:38:15Z")

</div>

Hi @flycode

Does it trigger a download when you access the URL directly in your browser? Have you tried different URLs and adding a new PDF viewer?

---

<div class="post-metadata">

**Author:** ![flycode](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@flycode](https://community.weweb.io/u/flycode)\
**Post date:** [April 2, 2025, 8:43pm UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497/3 "2025-04-02T20:43:07Z")

</div>

Hi @DanielL,

I managed to solve the problem : according to chat GPT the issue was because the URL didn’t use the “Content-Disposition: inline” header, so the PDF viewer (and also my browser, to answer your question) downloaded the file instead of displaying it.

So I had to generate another URL for this file using this updated header, and it worked !

So the issue was coming from the URL, not from the PDF viewer element, you need to have a URL that displays the file instead of downloading it

---

<div class="post-metadata">

**Author:** ![bongoumedia](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@bongoumedia](https://community.weweb.io/u/bongoumedia)\
**Post date:** [April 3, 2025, 9:09am UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497/4 "2025-04-03T09:09:01Z")

</div>

Also had this issue but it was my browser settings that download pdf instead of opening them in a viewer

---

<div class="post-metadata">

**Author:** ![thijs](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/thijs/32/13651_2.png) [@thijs](https://community.weweb.io/u/thijs)\
**Post date:** [April 4, 2025, 9:30pm UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497/5 "2025-04-04T21:30:50Z")

</div>

Hi @flycode ,

You can resolve it by providing the PDF viewer with the data in base64 (instead of an url), as explained here: [Show a base64 PDF from API in preview](https://community.weweb.io/t/show-a-base64-pdf-from-api-in-preview/6607)

---

<div class="post-metadata">

**Author:** ![flycode](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@flycode](https://community.weweb.io/u/flycode)\
**Post date:** [April 27, 2025, 11:02am UTC](https://community.weweb.io/t/pdf-viewer-doesnt-display-the-pdf-file/17497/6 "2025-04-27T11:02:52Z")

</div>

Hi thijs,

Yes this is indeed another option when the PDF url doesn’t work with the PDF viewer. Thank you !
