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 : https://drive.google.com/file/d/1n7

    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");
    
     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("BCA_fifthsemester.pdf");
    
     };
    
     jspdf.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js';
    
     document.body.appendChild(jspdf);
    

    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 ๐Ÿ‘

ย