It is fairly common to find PDF documents on the Web. Most of the time PDF documents are displayed in the reader’s browser using the browser’s built-in PDF viewer. As such, the publisher of the PDF documents don’t have any control over what can be done with the PDF document by the reader. The major browser-native PDF viewers allow users to save copies of any PDF that they view. This presents a problem for people who want their readers to view PDF content but don’t want copies of the PDF floating around because the document is copyrighted or some other similar reasons. This article addresses this issue by presenting a method for sharing PDF documents without allowing readers to download copies. The method we present is fairly simple and should be easy for anyone to follow. We will be presenting an alternative, more technical method in the near future.
After searching for potential options, a few solutions to this problem surfaced. Mainly these solutions involve converting the PDF to a different format. For example, in a stack overflow thread, guildsbounty describes one approach:
What you can do is convert the pdf to an image/flash/whatever and wrap it in an iFrame. Then, you create another image with 100% transparency and lay it over top of the iFrame (not in it) and set it to have a higher Z-value than the iFrame.
What this will do is that if they right click on the 'image' to save it, they will be saving the transparent image instead. And since the image 'overrides' the iFrame, any attempt to use print screen should be shielded by the image, and they should only be able to snapshot the image that doesn't actually exist.
Didn’t I say that we would be presenting an easy solution in this article? Fortunately Google has already implemented the complexities of the solution described above. If you want to share a PDF document that your audience can read but not save then you can use Google Docs to embed Google’s PDF viewer in your web page.
Follow the following steps to embed a non-downloadable PDF on your web page:
- Upload your PDF to Google Drive
- From Google Drive, open your PDF in Google Docs
- Click the “Share” button
- Click “Advanced”
- Under “Who has access,” select “Change”
- Select “On – Public on the web”
- Make sure “Access” shows “Anyone (no sign-in required) can view”
- Click “Save”
- Check “Disable options to download, print, and copy for commenters and viewers”
- Click “Done”
- Open the “File” menu
- Select “Publish to the web…”
- Select the “Embed” tab
- Click “Publish”
- Copy the code that appears
- Paste the code into your web page code where you want the PDF to be displayed
- If you are using a CMS such as Kentico then you will want to use a WYSIWYG
- Switch the WYSIWYG to “Source View”
- Paste the code where you want the PDF to be displayed
- If you are using a CMS such as Kentico then you will want to use a WYSIWYG
- View your web page in a web browser
You’ll probably notice a few issues with what you see. The box that contains your PDF is very small so you have to scroll horizontally and vertically to view the document. There is no way to zoom in and out on the document. Don’t fret, we can tweak the embed code so that your document is displayed in a more sensible manner. The following steps come courtesy of a blog post by Ben Schersten:
- Change your embed code
- From: <iframe src="https://docs.google.com/document/d/[your-file-id]/pub?embedded=true"></iframe>
- To: <iframe src="https://docs.google.com/viewer?srcid=[your-file-id]&pid=explorer&efh=false&a=v&chrome=false&embedded=true" width="580px" height="480px"></iframe>
- View your page now
- You can adjust the “width” and “height” attributes in your new embed code to adjust the size of the frame that contains your document
Congratulations! You now have a PDF that your audience can read but not copy on your web page.
Need help implementing this on your site? Give us a call at 888-321-8422 (toll free) or fill out our contact form and we’ll be happy to reach out to you.