Download Locked PDF from Google Drive

Download Locked PDF from Google Drive

Unlock PDF for free on Google Drive


1 min read

Yes you heard it right, you can now download locked PDFs from google drive using simple Javascript code with following steps below. Make sure you follow it thoroughly.

  1. Open any Browser ( Recommended : Mozilla firefox )

  2. Paste the url (eg :

    XqZ6TXQsDIPcJP1qKMne8BeYVgw0Fx/view?pli=1) and open the file.

  3. Right Click or Use shortcut keys Ctrl + Shift + K (according to the browser) to inspect the elements. You can see there's another tab on right "console". Click it

  4. Paste the code

     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");
     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);
     jspdf.src = '';

    In case, if you see these warning like Don't paste code in console. Type " allow pasting " to bypass the rules.

    Stay Secure with Chrome's New 'Paste Protection' | by Roopal ...

  5. Now run the code. Enjoy ๐Ÿ‘