Reputation: 3913
I'm developing a PHP MySql website in which pdf will be uploaded by site administrator. Viewers will get a list of all the pdf documents.
What I want is:
<div>
. I tried google doc viewer, it simply converts pdf to images which can be saved easily.
Also it gives View in Full
option by which one can easily download the pdf.
And ofcourse,
<div><object data="test.pdf" type="application/pdf" width="300" height="200"></object></div>
is not working. Please help..
Upvotes: 1
Views: 4569
Reputation: 14479
You can use an iframe to embed a PDF inside a div, though it will rely on them having a PDF-reader plugin enabled on their browser. However, there is no way to show a PDF to a user in a way that does not let them save it
In order to read the PDF they HAVE to save a tmp version on their computer in any case, so you simply cannot prevent them from having a copy if they want.
There are a variety of ways to make it more difficult, but that's it. Tieson's solution, which draws the PDF to an HTML5 canvass makes it difficult to get the original PDF for non-technical users, but it only took about 2 minutes for me to find the PDF source and download the original (i.e. http://hazaar.funkynerd.com/pdfdoc/get?file=acr5smallpdf_80327_7.pdf). There are other, similar approaches using java or flash that don't actually show the PDF, but rather a rendering of the PDF by a third-party plugin, which will make it even more difficult, but even then the user could re-create the PDF using third-party tools or just simple screenshots, etc.
Upvotes: 1
Reputation: 21211
It's not really 100% reliable/stable, but there is a jQuery plugin for Mozilla's experimental PDF.js at http://dev.funkynerd.com/projects/jquery-pdfdoc
Upvotes: 0