Skip to Content
Steps to Download Restricted Google Drive PDF

Steps to Download Restricted Google Drive PDF

Simple Method

Follow these simple steps to download a view-only protected PDF from Google Drive using Chrome browser:

Step 1

Open the PDF file in your Chrome browser. Wait for the file to load completely, then scroll to the bottom of the page.

Step 1

Step 2

Open the Developer Console by pressing Ctrl + Shift + C (F12) on Windows or Cmd + Shift + C on Mac. Then, click the Console tab.

Step 2

Step 3

Paste the following script into the Developer Console and press Enter:

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);

Step 3

Step 4

Once the process is complete, the PDF file will be automatically downloaded.

Step 4

Advanced Method

The simple JavaScript method works well for basic PDFs, but if you’re dealing with large or complex PDFs, the download might not work as expected. For better quality and handling of complex PDFs, try the advanced method.

Step 1

Download the Google Drive PDF Downloader file and extract its contents. Open the Method_1_Script.js file, copy the script inside, and paste it into the Developer Console, then press Enter.

Step 1

Step 2

After a few seconds, the browser will prompt you to save a file with the .PDF_DataFile extension. Save the file and move it to the Input directory located inside the folder you downloaded.

Step 2 Step 2

Step 3

If you’re using Windows, navigate to the Windows folder and double-click on GeneratePDF.cmd. For Linux, go to the Linux folder and execute GeneratePDF.

Step 3

Step 4

Once the process is complete, you’ll see a success message. Check the Output folder to find the downloaded PDF.

💡

Use Method_2_Script.js only for PDFs with fewer than 20 pages. If you encounter errors or slow performance, use Method_1_Script.js.

Resources

  1. Download View-Only PDFs from Google Drive
  2. Google Drive PDF Downloader on GitHub
Last updated on