Disable force file download on public link

Hi.
I have a public share link for example:
https://myadress…/index.php/s/X5qM4yKsirPI5HT/download?path=%2F&files=test.pdf

If I enter this link in my browser (Opera), then he will download this file without problems, but i want to preview this file in browser directly. How can I do that? Is it possible with a .htaccess file or something else?

Best regards,
olli

Try this:

It will open every pdf file like other pdfs in the internet. There is another application, like an e-book format. But the pdf.js is the most common.

Edit: Here is the other one:

Files_Reader App Store

If the “download” is in the link it will download. Otherwise it should show the web browser …

Sorry thats not what i want. I have this app installed in nextcloud. I want to preview the pdf file outside of nextcloud, only with the above link.

Okay thanks, but how must be the url for that?

For example:

https://myadress…/index.php/s/X5qM4yKsirPI5HT&files=test.pdf

That dont works for me…


This isn´t what you want? I think its a preview :smiley:

Link is:
/nextcloud/index.php/s/6z95PcnqYFKNgjt#pdfviewer

Download link instead is:
/nextcloud/index.php/s/6z95PcnqYFKNgjt/download

Maybe you can explain it a little bit more what you want. Because I do not know what you mean.

1 Like

Yes, its a preview, but its opened in nextcloud self. I want to show my pdf file in my browser directly without an app inside nextcloud. My share link is for a folder and inside that folder there is a pdf file. Do you know what i mean? :slight_smile:

You want to disable the blue frame, where you can choose on the upper right side: download / download-link and ‘add to nextcloud’???

Is that what you want to only open pdf without any nextcloud frames?
Well, what the matter? I think its the same like Dropbox?

No, i dont want to disable the blue frame. Yes, without any nextcloud frames. Ok I try to explain more:

I have a folder in nextcloud for public access -> public share link -> /index.php/s/X5qM4yKsirPI5HT
In that folder I have a .pdf file -> test.pdf

What I need is a direct link to my pdf file like this:
https://docs.google.com/viewer?docex=1&url=https://docs.nextcloud.com/server/9/Nextcloud_User_Manual.pdf

This example shows what i mean. Its a pdf, that the browser can open directly. All what i need is to disable the force download for my file. It should open, not download, but without in nextcloud. Another example:

I create a link like:
<a href="test.pdf" target="_blank">my pdf file</a>

Hope this helps to understand, what i mean…

Sorry, but for now I am confused.

Look at my Screenshot, isn´t it the same?

My first app link (pdf.js) will open pdf´s similiar like your google link:
https://mozilla.github.io/pdf.js/web/viewer.html

Thats contradictory :smiley:

Ok i think i know what you mean. Do you have created a public share link for pdf ? Cause my share link is for a folder, not a file… Sure, i can set a share link for my file too… but if i have many files…

Yes, I created public link for bitcoin.pdf :smiley:

I just cutted it out of my browser. On the right you see the scrollbar. :wink:

Allright, now i understand how it works. Thanks for your time :slight_smile: So i can share a file directly and have a perfect preview link to the file. But i think its hard to create share links for each pdf file manually. Thats the reason how i think about a share link for a folder and create the url with the share link (my folder) + file001.pdf…, file002.pdf and so on…

No you dont need to share every file. Just download files_pdfviewer:


to your apps folder. chown it to www-data and then even a pdf in a folder should be open with pdf.js

Yes I know. I go in my nextcloud folder -> click on my pdf file and its opening with the app files_pdfviewer.

So I have a list on my website, that shows ID numbers. What i want is to link every number to the correct pdf file in nextcloud. With other words: I want not going in my nextcloud and click on my file to preview it. I go in my list on my website (other domain), click on the generated link (with php and curl) which shoud be the link to the pdf file in nextcloud. I hope you understand, what iam trying to do :slight_smile:

Is the form for the correct link then.

OP wants to batch generate share links for individual pdf files (right?)

Hello everyone,

I have exactly the opposite question, but a little different :wink:

I’m trying to achieve direct/automatic download of a .pdf file. But I would like to achieve this by linking to the shared folder and appending the file name of the file in the folder.

Example:

My link to the shared folder says:

www.your-nextcloud.com/index.php/s/eigip7ceABzuww

and the files in the folder are called

example-file-0001.pdf
example-file-0002.pdf
example-file-0003.pdf

Calling up the link should now trigger the direct download of the file so that you don’t have to release all the files and share the links to them.

So for example:

www.your-nextcloud.com/index.php/s/eigip7ceABzuww/examplefile-0003.pdf

Unfortunately, this doesn’t work with /download/ before the file name.

Does anyone know any advice?