Serving up PDF documents for view/reading only online

Hi Team,

This will either be looking for advice…or suggesting a feature. Here’s the scoop.

We use Nextcloud currently for our document repo and we also use it to serve up folders of PDF documents. These PDF documents are our companies Stored Operating Procedures so only keep them for online use where employees read them during training. It’s working well for us in that I can create a public link and share it out to our workstations (our Nextcloud is not Internet facing and is only used in our LAN). The problem with it though is there are download buttons and print buttons for each PDF document. We’ve removed the ability to upload or delete or modify these documents. We’ve instructed our employees to not download any files and just read them online. But it looks messy and I can’t find a way to remove these download options from Nextcloud (without digging into the code and changing Nextcloud for download for our other files).

Is there a way that this community is aware of where I could use Nethserver (or Nextcloud) to serve up folders of PDF documents to our users and just have it so they can only read the documents online? No modify, no upload, no download no print options available?

Any advice would be greatly appreciated!

Thank you.

short answer: no, you can’t… once you publish them you can’t control how the browser will manage them

Hello @Stefano_Zamboni,

If you are refering to the browser allowing me to print (CTRL P) or someone taking a screenshot then yes I agree, managing what can be done from the browser is limited. Nextcloud works for us in that our managers can update and remove PDF files from Nextcloud since they have the proper access. Our employees are already instructed not to download. I just want the interface our employees see and use to be cleaner without print buttons and download buttons like they see now in Nextcloud. I would prefer if all they could see was the folders/files for each PDF and when they click on a PDF it opens in a PDF reader on the screen.

I’m not looking for a secure system that will keep these files from being copied (I realize that’s almost impossible). Just hoping someone has a good solution they use or perhaps something that can be implemented into Nethserver (or something someone can instruct me on how I can build it) to serve my specific use case.


1 Like

Something like “online pdf web viewer”? …IIRC Google Drive has a similar function

Maybe @jospoortvliet has some news about Nextcloud!

Edit: a quick search and they already have it

You could ask the NC Community too!


Yeah, there’s a download & print botton, these are part of the PDF viewer app we use I believe. You might be able to disable the Nextcloud built in PDF viewer, perhaps the browser will then use its own PDF viewer, that might work. Anything else would need changes to the code…


Hello @davidep and @jospoortvliet, thanks for your replies and suggestions.

I’ve been kicking at this can for years (since I began using ownCloud I think version 7 or 8). I do use the files PDF viewer in Nextcloud and I prefer to use this plugin as it opens the PDF in the same window and it doesn’t download the file (which is what could happen if I use the Chrome PDF viewer unless I set the workstation to now download). The Files PDF Viewer Plugin in Nextcloud does have extra buttons that I don’t need on it but I can live with them since I know these are part of the PDS.js library and I don’t expect Nextcloud to want or need to modify how that library works.

What my main issue is those Download options from within Nextcloud itself. The big Download button at the top of the page and the download option (behind the elipses for each file) are what I want to remove. I’ve been asking this question from ownCloud and now Nextcloud in their forums for years but the answer is always the same sadly…get into the code and change it myself.

I can fully understand why the download buttons are there…Nextcloud (and ownCloud) are document repository sharing applications. But having control over our documents is also built into Nextcloud/ownCloud so obviously having control is something Nextcloud feels is important which is why they built Apps for that.

Nextcloud has provided an Official App for document control called ‘Files Access Control’. This app allows file shares to have editing or deleting removed if so desired. So obviously Nextcloud realizes that control over the files you share is something people need. But why then do they allow a download of the file? Yes this App assumes the owner of the file share doesn’t want their files on their share to be modified (which is what the App is there for)…but what if the owner of the fileshare only wants people to read the file and not edit it or download it. As a document sharing repository giving full control over your documents (to edit and/or download it) is what people should have.

I realize my usecase is specific in that I’m using my fileshare to allow our employees to easily read their procedures online without having to shuffle through paper that they might lose. But I do hope my thoughts on document control with allowing or disallowing editing and downloading changes some minds at Nextcloud.

Straight up I’m not a developer so I don’t have the means or the time to learn how to dig into the code to hack it for my needs. And I don’t want to hack the code only to have the changes removed upon the next update to Nextcloud. Hopefully my little rant here will one day mean we have a little more control over our documents from Nextcloud and not just partial control. Ok…I know there are holes in what I’m trying to achieve and there are lots of ways probably that files can still be downloaded or modified without the file owners approval but I still feel stronly that editing, deleting and downloading should be options to any folders/files shared in Nextcloud.

Thanks for listening!

I Totally agree with this…! This feature should be out of the box…!

1 Like

Thanks for your suggestion @greavette but that’s out of our hands. You should open a new feature topic on
I guess that Jos’s people will be happy to take it into account

Hello @alefattorini,

Sorry, I don’t think I made myself clear with my post here. My response to jospoortvliet was a hope that the Nextcloud team would read my reason for wanting a change in Nextcloud. Eventually I posted in Nextcloud and received a response that the Nextcloud team would not be implementing my type of change in core but that my change is better suited to a module being added. They had good reasons for not wanting to implement no download in core…sadly I don’t have the knowledge nor the time (at this time) to figure out what I need to make a Nextcloud App to remove the download.

But as for the reason for my initial post here in Nethserver, another option I was looking for was to see if anyone here at Nethserver has a solution they could suggest to me on how I can serve up all my PDF files from a folder to a wepage. This solution does not need to be a Nextcloud solution only.

Based on the lack of responses for a Nethserver solution I don’t believe there is one. :slight_smile:

Really Nextcloud is doing a great job at serving up my PDF documents for our office. We instruct our employees not to use the download button when they open a document.


Thanks for your explanation, you’re making a great job here :slight_smile:
I’m afraid I can’t help you with this one

I found this: ViewerJS
How to disable download button in ViewerJS:

I found it in a quick research and I don’t know if it works or no…

@greavette did you check @saitobenkei’s suggestion yet?

Hi @saitobenkei, thanks for the suggestion. something for me to consider for sure…

I’ve thought about his suggestion @alefattorini but I’m wondering if I can use ViewerJS in the nethserver web server? I’ve not use nethserver webserver before so I don’t know how to add ViewerJS to it? What do you think…would this work in the nethserver webserver in your opinion?

Hi @greavette, it seems to work!

Very very very dirty example that I have tested:

On Nethserver create a virtual host, put all the unzipped directory ViewerJS inside the vhost directory where the site has to be.


On this folder you have to create a file local.css (or rename the file example.local.css in local.css) and add inside it:

#download {

Modify the file index.html inside te ViewerJS folder uncommenting the row

<link rel="stylesheet" type="text/css" href="local.css" media="screen"/>

Inside the root of your site create a pdf folder and put inside your pdfs.

mkdir /var/lib/nethserver/vhost/mysite/pdf

create a index.html file inside the root of your site:

vi /var/lib/nethserver/vhost/mysite/index.html

	<a href="/ViewerJS/#../pdf/LoremIpsum.pdf">Lorem Ipsum</a>

then chmod and chown your site:

cd  /var/lib/nethserver/vhost/mysite
chmod -R 750 *
chown -R apache *

open the broswer and open the site, then click on the link: you should see the pdf without the download button in the upper-right corner.

Note that if you write the full path of the file pdf in your browser, you can continue to download it


is still downloadable


Or you can play with this:

I don’t have time to test it


Ok, I tried and it seems to work:

download this (It’s a download from page) and expand it in a vhost on nethserver.

Go to /var/lib/nethserver/vhost/mysite/web then modify the file viewer.html adding the style

style="display: none;"

to the buttons that you want to hide

For example

        <button id="download" style="display: none;" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
          <span data-l10n-id="download_label">Download</span>

Check carefully the code because you will find two buttons for the same operation:

For example:

    <button id="secondaryDownload" style="display: none;" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
      <span data-l10n-id="download_label">Download</span>


        <button id="download" style="display: none;" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
          <span data-l10n-id="download_label">Download</span>

I use the style="display: none;" method because if I try to remove the button section or comment it, the view of the document doesn’t work…

Connect to the site


At the Welcome Page click on the “DEMO” button at the center of the screen.

You should see a PDF without the download button in the upper/right angle

With the same method you can disable the “Print” and “Upload” buttons and the other buttons.



The reason we won’t remove the download button is that it is SUPER easy to work around and get the file. The pdf viewer works by downloading the file to the browser and displaying it. So hiding a download button is pure cosmetics, you’ve ALREADY downloaded it.

We don’t want to lie to people and provide a fake sense of security - you can’t disallow ppl downloading a file if you want them to see it.

ok. So I just had an idea: Collabora Online. Unlike the PDF viewer, it doesn’t download files to the browser. It downloads them to the Collabora Online server you have to run next to Nextcloud and from there streams the rendered content to the browser. So that is much harder to work around - you can only take screenshots.

This might be reason to add a ‘hide download’ button. Perhaps via an app, but still.

I’ll start a conversation internally.


Man, as always thanks for jumping in and making the matter clear to all of us.

1 Like

No promises. Ppl agreed it is a solution, the question now is - is it worth the effort and who does it. If anyone here knows PHP, this is the time to offer help…

1 Like

Hi @jospoortvliet,

Thanks very much for stepping in to educate me/us on how the PDF viewer works. I didn’t realize that by using the PDF viewer this was essentially a download as well. In our case we use only thin clients in our office so no one has the ability to take what’s been downloaded from their desktop to the thin client…but anyone can take out their cell phone and take a picture so there really is no way to 100% be certain that our data can’t be stolen. :slight_smile:

I’m very interested in your suggestion to use Collabora. Downloading the PDF to the Collaboara server would be a solution to our problem as well. I’ve tried to use Collabora and had major issues setting it up on a separate server and getting it to work with my Nethserver Nextcloud…I was able to successfully setup and use Onlyoffice…I’ll need to inquire with the Onlyoffice team to see if PDF’s could be viewed in Onlyoffice as well.

I’m also very interested in your review of adding an app to remove the download button. I wish I knew PHP or I would definitely step into assist. Thanks again for stepping in to provide comment.

1 Like