download undownloadable pdf Downloading “undownloadable” web PDFs with Fiddler. I was once teaching a course in the area of backend engineering. I didn’t own the course ma t erial, my duties included going over and presenting the slide deck that I had been provided by the course coordinator, answering any outstanding questions from the class, being on time, having lunch, and timely getting lost at 5:30 pm. At the end of the course, naturally, the students asked me to share the slide deck with them so they could go over it on their own. And that’s when the issue revealed itself — the course slides were provided to me via a secure document sharing platform, let’s call it PDFLord [I won’t mention the actual name for the sake of… reasons], which imposed downloading and printing restrictions on all the course PDFs. So, unfortunately, the students had to leave the class empty-handed. However, something didn’t seem right in my mind — if you can see the document on your screen, surely its source is hiding somewhere in the files downloaded/cached by your browser, and consequently the download restriction is artificial in a sense. In this article I will show you a method to overcome these restrictions that I discovered in the two days following the course. My tutorial will assume MacOS (High Sierra) development environment, Chrome browser, and PDFLord platform, but similar steps could be undertaken for other operating systems and other document sharing platforms. To begin with, let’s list the reasons why PDFLord was a bane of my existence: As mentioned before, the PDFs had downloading and printing restrictions (as indicated by the grayed out icons in the top right corner). The PDFs were copy-protected, meaning I could not select any text (as indicated by the “Protected File” pop-up on mouse click). The PDFs were unsearchable, meaning I had to memorize the page numbers of all sections in the course that I wanted to quickly navigate to. There was no fullscreen or present button. My first intuition was to examine the page source files. I will skip the parts where I was randomly clicking through all possible directories and folders while looking for the right files, and instead will go straight to the ones relevant to this tutorial. You can press Command+Shift+C to bring up the developer console in Chrome. Then open the Sources tab. As you can see there is a pdflord.com directory, with a plugins folder under assets . If you scroll down, you will find a folder called pdfjs , which contains two files — pdf.js and viewer.js. It turns out that PDFLord is using an open-source PDF rendering and parsing library by Mozilla, which you can find here ://mozilla.github.io/pdf.js/ Let’s dig through the viewer.js file a bit more. After some inspection we find a method which sounds like it deals with page rendering: Let’s add a breakpoint on line 2141 inside this method right after the pageView variable and reload the page. Our goal is to examine what the object pointed at by this variable represents. After clicking through a bunch of object members… voila! We finally stumble on what we have been looking for — an integer array that very likely represents pixel data of the image of page 1 of the PDF. Surely, now we can just write a script to go over every page in the PDF, extract the image data arrays, convert them to jpegs, and end up with a sequence of images of the PDF file. To be honest, I wasn’t quite satisfied with this finding — I would still not be able to select any text or search through the images. I was looking for a better way. If we examine the viewer.js file a bit more, we find another interesting function: In particular, there is this very intriguing line which looks like it deals with restricting downloads: And then we also find the following sequence which deals with binding events to button click listeners. It’s amusing how the “print” and “download” events are very sloppily commented out, most likely to handle print and download logic in a different part of the code. At this point our action plan is clear: We will rebind one of the buttons to serve as a download button (simply uncommenting the download event listener didn’t work, I didn’t dig too much into why). Change the download permissions logic to not require allowdownload. . Proceed to downloading the PDF. To make changes to javascript files returned by a web page we need a man-in-the-middle proxy server. For this purpose, we will be using Fiddler — a free web debugging proxy by Telerik https://www.telerik.com/fiddler. Fiddler was originally developed as a Windows application, and only recently got ported to Mac. On MacOS it runs using Mono — an open-source implementation of .NET Framework. You can follow this tutorial https://www.telerik.com/blogs/introducing-fiddler-for-os-x-beta-1 to install Mono and Fiddler. The only difference is that Fiddler 64bit version doesn’t work on OS X, so you would need to use this command to start Fiddler and avoid errors: Most websites nowadays use https, so we need to configure Fiddler to correctly capture and decrypt https traffic. Open Tools->Options- >HTTPS, and check the Decrypt HTTPS Traffic checkbox. Since Fiddler acts as a proxy, browser traffic gets redirected to it. All browsers know how to protect user data from man-in-the-middle attacks, so they don’t let the traffic be delivered to actors whose certificates are not trusted. To bypass this constraint we click on Actions-> Export Root Certificate To Desktop . Next, open Keychain Access — MacOS app that manages certificates — and drag-n-drop the generated certificate from your desktop to the Keychain window. The certificate will appear as DO_NOT_TRUST_FiddlerRoot. Double click on it, and in the new window select Always Trust. The final step is to actually redirect the traffic from Chrome to Fiddler. Open System Preferences->Network->Advanced->Proxies. Check Web Proxy and Secure Web Proxy , and for both set the host to 127.0.0.1 and the port to 8888. Click Ok , then Apply . You should now start seeing the traffic from your browser in the main Fiddler window. If you don’t see anything, try using an Incognito Window. Now the fun part: hacking the javascript files and serving them in place of the original files. Download (or copy paste) the viewer.js file, open it in your favorite editor, and replace line 10279 with: In short, we are binding the download event to the zoom-in button. Next, remove `PDFViewerApplication.appConfig.allowdownload ` from lines 1475 and 5067 (and anywhere else in the file for that matter): Our substitute viewer.js file is ready for deployment. Find and select the viewer.js resource in Fiddler (you might want to stop capturing traffic to prevent the window from refreshing by disabling File->Capture Traffic). Then in the panel on the right select AutoResponder->Add Rule. In the bottom drop-down menu choose Find File , select your substitute viewer.js file and click Save . Make sure both Enable rules and Unmatched requests passthrough are checked. Aaaaaand… drum roll… we are done! We are ready to download our PDF. Open your Chrome window with the PDF viewer. With your debugging console being open, right click the refresh button and click on Empty Cache and Hard Reload. Don’t forget to reenable Capture Traffic in Fiddler. Emptying the cache is necessary to not let Chrome pick up the original version of viewer.js and instead make it download it again from the web. The downloaded javascript file gets intercepted by Fiddler and replaced with our custom one. Now, whenever you click on the Zoom In button (“+”), your PDF will get downloaded. Great success! Final thoughts and lessons learned: When any data reaches your computer, there is absolutely no way to guarantee its complete integrity. Basing your business model on a premise that the data you share is fully secure and protected is a terrible idea. Hope y’all who got this far had as much fun with this tutorial as I did when fiddling with this challenge. Disclaimer: use at your own risk. Make sure you are not breaching any contracts with your document providers. There is a very obvious potential harm to the business models of the secure document sharing companies. How to Force Download Files from Google Drive. Force Download from Google Drive – Google Drive is only second to Dropbox and you can easily upload and share files using the awesome cloud storage service. In Google Drive, you can pretty much upload and share almost any and all sorts of files. Moreover, you can collaborate with your team members on editing and modify these uploaded files. That being said, Just like in Dropbox, there is no easy way to download files or docs from Google Drive as it can pretty easily handle most of the common file types and displays or renders them directly in your browser. Though this is convenient in most cases, this may be a pain if you want people to download your files instead of viewing them right in their browser. So if you ever want to download files from Google drive, here is a simple tip to force Google Drive to let users download the file instead of rendering them inside the browser. Related: How to Remote Upload Files to Google Drive. Force Download Files From Google Drive. 1. To make this trick happen, all you have to do is change the URL structure of the shared file. 2. For instance, the below URL is a PDF document of Windows 8 shortcuts that we published earlier. If you follow the link below, Google Drive will automatically render and display the PDF document in your browser (if your browser is supported) rather than letting you download it. Force Download Files from Google Drive – Copy ID. 3. Now, to force download the file from the Google Drive, all you have to do is to copy the “ file ID ” from the above URL and paste it in the below URL format. 4. Once you have pasted the file ID , the final URL will look something like the below one. Now if you follow the link, the file starts to download instead of rendering inside your browser. Force Download Files from Google Drive – Enter New URL. That’s all there is to do and it is that simple to force download files from Google Drive. Related: How to See the Number of Files in a Google Drive Folder. Hopefully, that helps and do comment below sharing your thoughts and experiences about using this simple tip to force download file from Google Drive. How to Make a File Downloadable from Your Website. This article was co-authored by our trained team of editors and researchers who validated it for accuracy and comprehensiveness. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards. This article has been viewed 901,299 times. Offering download links for files through your website is a common desire, and there are a couple ways to do it. Sites that offer website building tools, such as GoDaddy, WordPress, and Weebly, often offer the ability to upload a file at the same time as you make a link. If you build your own site from scratch, you can create download links using simple HTML code for files hosted on your server. Your FTP client should already be configured to connect to your webserver since you've uploaded your site there before. If it isn't, see How to Use FTP for instructions on configuring your FTP client to connect to your server. If your web server has an online control panel, you can access your server files directly through the web management interface. You'll be able to access this when you sign into your site as an administrator. Once you're in the control panel, select the "File Manager" option. If you created your website using a website creation tool like WordPress, Weebly, or Wix, see the platform-specific instructions in the methods below. To upload files using your FTP program, drag the file into the folder in the FTP window that you want to upload it to. It will begin uploading immediately. Your upload speeds will typically be much slower than your download speeds, so it may take a while to completely upload the file. If you are using the virtual control panel file manager, click the "Upload" button at the top of the window. Browse your computer for the file you want to upload. Large files may take a while to upload to your server. The download attribute does not work in Safari, , or Mini. Users with these browsers will open the file in a new page and have to save it manually. [2] X Research source. It may take a little while to upload files, as most connections are slower uploading than downloading. Basic users are limited to files 5 MB and smaller. Premium users have a 100 MB file size limit. Text - Click the Link button in the Text Settings window. The button looks like a chainlink. This will open the link menu. Image - Select "A link open" from the "When image is clicked" menu in the Image Settings window. Click "Add a link" in the "What does the link do?" section. This will open the link menu. Related wikiHows. ↑http://www.w3schools.com/tags/att_a_download.asp ↑http://caniuse.com/#feat=download ↑https://make.wordpress.org/support/user- manual/content/media/adding-media-to-your-pages-and-posts/adding-files-for-download/ ↑https://www.godaddy.com/help/add-a-downloadable- file-with-button-link-8473. About This Article. To make a file downloadable from your website, start by creating a folder on your server for both your website's HTML page and the file you want to share. Once you make the folder, you can find it by using your Control Panel's file manager or the file browser in your FTP program. From here, you can begin uploading files immediately by simply dragging them into the folder in the FTP window or by clicking the "Upload" button in the virtual control panel manager. Once everything is uploaded, open your web page in the code editor and place your cursor where you want to add the download link. Finish by using HTML5 code to create a download link for the file, then save the changes you've made to your HTML page. For more tips, including how to make a file downloadable from your WordPress site, read on! How to make PDF undownloadable using pdf.js. I found the pdf.js project, which is very useful. However, I am unable to figure out how to remove the "Download" option. 7 Answers 7. Here are the steps: Add jQuery library to shared folder. Include jQuery library to viewer. file. Add this on the header section: Just deleting the buttons breaks pdf.js. You need to add a "hidden" class to them (https://github.com/mozilla/pdf.js/issues/2611) just add this in viewer.. Modify the source. Line 85 of web/viewer.html. Just remove the button. This won't completely stop experienced and eager users from downloading it. You can never stop that. But this is enough to raise the bar enough for the curious. Another way to do it actually looks to be using pdf.customise.js (a WordPress plugin that comes bundled with it does it this way). I did this to remove the openFile button. First, in viewer.html , add this: Then, make your pdf.customise.js like so: I don't like that this uses jQuery instead of pure javascript (however it could be easily rewritten that way), but still works really well. Download undownloadable pdf. Recently Google made a changes to their policy so that now users can not download view only pdf file from Google Drive. But now we bring you a simple JavaScript Code by using which, you can download any view only protected pdf file from Google Drive. by using this code, you will be able to download shared view only protected pdf from Google Drive. 1. Open the view only pdf file in Google Drive in new window 2. Scroll to the bottom of the file so that every page will render 3. Open developer Tools on separate windows by pressing F12 and select Console Tab 4. Paste the following code in the console tab. Above code will start working and the all the pages present in the file will start rendering. After some time, pdf should start downloading automatically or will ask to download. Kindly note that download pdf file will not be editable and may be large in size as it contained images.