71GA
71GA

Reputation: 1391

Embed PDF on a webpage and prevent download

Is there a way to embed a PDF document on a webpage and at the same time disabling download? If possible I would prefer an html5/css3 solution. If no other way is possible I'd go with something else.

Upvotes: 13

Views: 88149

Answers (6)

Dario Rusignuolo
Dario Rusignuolo

Reputation: 2186

just add #toolbar=0 to the url of the pdf

Upvotes: 16

user9138873
user9138873

Reputation: 7

You can download the PDF.js and modify these 2 files: viewer.html and viewer.js, remove/modify the corresponding buttons/actions in order to disable downloading/printing, and you can furtherly disable right click menu items.

Upvotes: -1

FiringBlanks
FiringBlanks

Reputation: 2084

Yes. Yes there is:

<div id="pdf">
    <object width="100%" height="650" type="application/pdf" data="[ImageURLHere]#zoom=85&scrollbar=0&toolbar=0&navpanes=0" id="pdf_content" style="pointer-events: none;">
        <p>Insert your error message here, if the PDF cannot be displayed.</p>
    </object>
</div>

The pointer-events: none styling will also prevent users from right-clicking the PDF and downloading.

Upvotes: 11

Puce
Puce

Reputation: 1021

You can use SlideShare, you can set a read password, prevent users from downloading in the settings, and even create a secret link so only users with it can open it. I am sure there are ways to circumvent this, but at least it's not immediate.

Upvotes: 0

mirecsvk
mirecsvk

Reputation: 89

Actually, it is possible, you can adjust in your Google Drive option "Prevent viewers from downloading" Then set PDF file public, so everyone can view PDF in Viewer, but none can download it. I hope, that this will help for some.

Upvotes: 8

Michael Slade
Michael Slade

Reputation: 13877

Short answer is, it can't be done. The only way to view a PDF document without any kind of conversion is via the adobe PDF plugin, and that invariably allows the document to be saved. On top of that, it's trivial to use various tools to get the url of the PDF and download it from there.

If you want to avoid sending the actual PDF document, you could create a server-side script that converts the PDF document to a series of PNG or JPG images behind the scenes. You can do this with ghostscript for example.

But then, the actual content of the document still reaches the user, only in a different format. If this is not satisfactory for you, there are various techniques you can use to prevent most users from saving the images, but these are easily circumvented by a sufficiently technically savvy user.

Upvotes: 5

Related Questions