0

I have hundreds of PDF files that i need to present to users. When presenting these files through my MVC web app i don't want the users to have the ability to download the files, e.g.. i don't want the Acrobat reader controls for print/save showing up. Reading this stackoverflow post it seems that it's not possible to disable those controls.
I know users can still take screen shots and print out the page, but that's not an issue in my case.
What is the best way to go about this. I've reasearched using SWFTOOLS which looks like it may be a good solution, but i dont want to save the swf files to my filesystem. The optimal solution is PDF.js, but another problem i have is users will be accessing the files through IE8 - so PDF.js is out of the question. Unless there is another similar library that will convert the files to HTML 4.

Basically I just need to display the PDF files, on the fly would be best, in a different format than PDF

Any suggestions?

Community
  • 1
  • 1
BradP
  • 77
  • 2
  • 13
  • What about converting them to a low resolution JPEG ? Can you explain exactly what limitations do you need? – kiks73 Mar 18 '15 at 20:43
  • The approach is simple, but what have you tried? Several libraries exist to accomplish this. – Greg Mar 18 '15 at 20:43
  • Using something like GhostScript? – BradP Mar 18 '15 at 20:43
  • @Greg I havent tried anything yet. Just finished building the site and now it displays the pdfs in a webpage using acrobat. At this point i'm researching the best way to present the files NOT in acrobat. I've read quite a few posts, I'm just looking for a simple way to present the files. – BradP Mar 18 '15 at 20:45
  • @kiks73 the only limitations i really have is to not have a button on the page to save or print the document. basically we just want to make it 'not so easy to save the docs. I know there's no way to prevent people from taking screenshots or printing the webpage. – BradP Mar 18 '15 at 20:56
  • DynamicImage looks like a promising library ... https://github.com/tgjones/dynamic-image – BradP Mar 18 '15 at 22:21

2 Answers2

0

I would convert it to an image file, you can find tools or write script to do it, I personally would do it by displaying them in browser first and then use browser plug-ins to take screenshot of the entire webpage. (you can automate this) then just display then converted pdfs **this is probably not the best solution :( **

Gugg
  • 240
  • 3
  • 12
  • I have hundreds of PDF documents ranging from 2MB to 15MB that change on a daily basis. I have a console app that monitors the directory the files are in and updates a list on a webpage – BradP Mar 18 '15 at 20:49
  • http://smallpdf.com/pdf-to-jpg use this type of service each time a pdf is updated.. – Gugg Mar 18 '15 at 20:53
  • This is sensitive information, i cannot run the docs through a web service. I have to do it locally. – BradP Mar 18 '15 at 21:09
  • try to build some floating shinanagin that blocks where the save as or download button will appear in html.. – Gugg Mar 18 '15 at 21:24
0

I had a similar project a while back, where sensitive pdfs were needed to be displayed to specific users but they weren't allowed to download/print/save it.

Since it was a web app I ended up using pdf.js. It is Mozilla's PDF renderer for firefox. It renders the pdf on to a canvas and by default has all the bells and whistles. If you have firefox, open a pdf file to see it in action.

It was tough to get it running at first but I ended up using a demo I found online as the base of the project. After removing each functionality that was forbidden the finished product did exactly what was required. You will need to add a print css file to block printing or find a better solution. I ended up using the css approach since print preview by passed my javascript check for the print action. Also ensure you block ctrl + s which allows the user to save the pdf.

Another aspect to note is that it works better on later versions of IE and struggles on older versions as the file size increases. Firefox and chrome are not a problem and I believe its the same for opera although I haven't tested that.

Judge Bread
  • 501
  • 1
  • 4
  • 13
  • i've looked at pdf.js and that would be the best solution.. but the problem is that users are using IE8 and there's no way i can get around that. Thanks for the suggestion. – BradP Mar 20 '15 at 15:10
  • That sucks. Out of curiosity, have you tested pdf.js on IE 8? Does it work or is it too slow? I only tested on IE9+ and would love to know how it functions on older IEs too. – Judge Bread Mar 20 '15 at 16:58
  • I used IE11's dev tools and emulated IE8 using the demo @ https://mozilla.github.io/pdf.js/web/viewer.html - It did not render the page, blank page. Most likely because _pdf.js_ uses canvas and IE8 doesn't support canvas. – BradP Mar 24 '15 at 15:47