Download Restricted Google Drive PDF
Simple Method
Follow these simple steps to download a view-only protected PDF from Google Drive using Chrome browser:
Open PDF in Chrome
Open the PDF file in your Chrome browser. Wait for the file to load completely, then scroll to the bottom of the page.

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

Execute the script
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);
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.
Download the Downloader Script
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.

Save and Move the Data File
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.


Generate the PDF
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.

Success!
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.
