Google Drive is the most popular online data storage service today, and surely every one of us has used it.
Of course there are times when you won't be able to download PDF files or DOC files from Google Drive because the download feature is disabled. In case the ability to download a file is locked by the owner (protected files) in Google Drive, below we will see how you can download it.
Warning: The method below is published for educational purposes only. Be careful when downloading such files because they are legally protected.
Table of Contents
How to download view only PDF files with JS
Open the URL containing the file you want to download, wait for it to open and scroll down to the last page.
Open the browser console window (Chrome dev tools), press Ctrl + Shift + I (for Windows).
In the console tab, copy – paste the following code and press enter. (Or download the code from here)
let jspdf = document.createElement("script"); jspdf.onload = function () { let pdf = new jsPDF(); let elements = document.getElementsByTagName("img"); for (let i in elements) { let img = elements[i]; console.log("add img ", img); if (!/^blob:/.test(img.src)) { console.log("invalid src"); continue? } let can = document.createElement('canvas'); let con = can.getContext("2d"); can.width = img.width; can.height = img.height; con.drawImage(img, 0, 0, img.width, img.height); let imgData = can.toDataURL("image/jpeg", 1.0); pdf.addImage(imgData, 'JPEG', 0, 0); pdf.addPage(); } pdf.save("download.pdf"); }; jspdf.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js'; document.body.appendChild(jspdf);
How to download view only PDF files with extension
Open Chrome and install the extension “GoFullPage - Full Page Screen Capture” by clicking “Add to Chrome”.
Open the URL containing the file you want to download, and click on the extension icon.
The extension will capture the entire document, you just have to wait until the document page is displayed. Click the download button to download the document.
Dummy
If all of the above looks Chinese to you, try opening the PDF you are interested in through this site.
Explaining in half-Solski and half-English doesn't make sense. Change the title because no one understands what you're trying to say