brunoc68 The issue is that this way of doing gives a result which depends on your browser configuration. In my case, a pdf is not previewed but downloaded.
May I ask what browser/OS this is? I think it's only Android browsers and Explorer 11 that does not open PDF files in browser by default.
https://caniuse.com/pdf-viewer
brunoc68 It is always a nightmare when the admin has to go on every device to set the browser's settings.
Indeed.
brunoc68 I guess the iframe version would come to the same constraint, wouldn't it ?
Yes, because the browser must be able to render the PDF in browser in any case.
There are other solutions. For example pdf.js can render PDF's in browser without having PDF support directly in browser. However, the interface is clumsy, and I am hesitant to integrate a very large JS plugin into Files Gallery just to support the few browsers that don't already support PDF. Another option is to use Google docs viewer (see example, does it work for you?). Although it's a solution, it requires using Google url's to view PDF documents, which also is only beneficial for browsers that can't already read PDF files.