How to Prevent PDF Document from Being download to users PC?
How 开发者_如何学Goto Prevent PDF Document from Being download to users PC? it can be viewed on browser but should not download the file to PC.
Is it possible?
if its viewable on browser its been downloaded
So you want the bits to get the to user so he can see them on his browser but you also don't want the bits downloaded to the PC? That's inconsistent and thus impossible.
One option is to render the PDF to JPEG or some other image format and only serve the rendered images to the user. Some of the PDF libraries allow you to render PDF's to other file formats.
Another option may be to send/redirect the PDF through to an online PDF viewing app in the same way Google does with attachments in GMail. That way the user sees a JPEG of the PDF and cannot download the PDF.
The browser will at least download it into its cache.
I ran into this issue a few days ago and I solved my issue using flash. I created a bare bones PDF viewer with forward and back buttons and the ability to jump to a desired page. The pages load in as high-res jpgs using XML to keep track of the pages for the various documents. This doesnt really stop a person from ever stealing the PDF (they could take screen shots) but it is acting as a deterant.
Note: that this option obviously doesnt support mobile viewing (not a concern given the users of these documents for me though)
精彩评论