PDF viewer doesn't display the PDF file

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.

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?

Hi @danlopes,

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

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

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