How to make pdf-file to be downloaded

I have some pdf, zip и stp (3D-structure) files in my blocs project which I want to be downloaded by users

Zip-files are downloaded with no problem

But when clicking on pdf-icon which I set to “Download File” in “Interactions” it opens pdf in browser instead of downloading it.

Is there any way to make pdf-file downloadable?

Thanks

Hi @Heyga4Huk,

Yes should be able to do this by adding a custom attribute to the link called download. You can add a new name for the file thats downloaded if you want also.

download="filename"

I haven’t tested it. But it is a valid HTML attribute.

The behaviour you are seeing is effectively dictated by the user settings of the browser. If they have it set that way either deliberately or by accident it is because they do not want PDF files downloaded to the computer. Most browsers nowadays are capable of viewing PDF with the option to then download or print.

If you start forcing downloads there is a chance you will annoy visitors.

Yes lol, that too. But I hate it when a button marked “download” opens a pdf in a tab :wink:

Yes I know and I have two links on every line: “watch pdf description” and “download pdf description”. But they are both opened in browser and that annoys customers!)

Thank you for advice but as far as I can see it cannot be realised via blocs. I should be doing this manually with blocs generated html-file. Am I right?

You should be able to add it using the Custom Attributes in the side panel.

Again I haven’t tested it in Blocs. If that doesnt work, use a code bric and do it manually would be an option.