UPDF 2nd Anniversary Sale - Grab the Chance to Win iPad Air! Learn More

How to Download Protected PDF from Google Drive? (In Seconds)

When someone shares a PDF file with you, they have the ability to prevent you from opening it with a password. In such cases, you can only look at the content of PDF files without being able to save or download them.  But what if the protected PDF file is shared by yourself, but you lost your Google Drive account and do not remember the password? In this case, you have to know how to download it. And the simplest way to download a protected PDF from Google Drive is by using JS code.  Here is the step-by-step guide

Why can't I download the PDF from Google Drive?

If you are unable to download the PDF from Google Drive, there is a high chance that the person who has shared the Drive with you has restricted access to download the PDF. In this way, the viewers cannot download, print, or copy the document from the Drive.

Method 1. How to Download Protected PDF from Google Drive

Then how can you download a protected PDF from Google Drive that is protected by Google Drive's sharing settings?

You can still download the PDF protected with the sharing settings of Google Drive by following these simple instructions:

Step 1: Open the protected PDF in Google Drive and take a scrolling screenshot of it using a Chrome extension or any screenshot tool like GoFullPage and export the screenshot in PDF format.

Step 2: Afterward, open the created PDF in UPDF and read the document with a premium reading experience. If you want to annotate the document, you can tap on the "Comments" tool from the left and annotate the document using any tool like Highlighter, Underline, Sticky Notes, Text Box, Signature, Stamps, Measure, and Text Callout. Download this all-in-one PDF software to enjoy all the features now.

Windows • macOS • iOS • Android 100% secure

Step 3: UPDF can even help you to transfer your image-based PDF into a searchable and editable document using its advanced OCR technology. Once you apply the OCR feature of UPDF, you can edit the text and other details of the document.  

Method 2. How to Download Restricted PDF from Google Drive?

To put it simply, Google Drive is a helpful tool that lets teams and individual professionals work together for free. You can edit, share, and keep your PDF documents there. The good thing is you can even work on your files without the internet, and once you're online again, it saves the changes made offline. One big plus point is that Google Drive works on different devices.

However, sometimes the PDFs you need to work on are restricted and cannot be downloaded. This restriction can be due to the sensitive information stored in those PDFs. But we have you covered with a simple solution. You can easily run the JavaScript code to download the PDF file automatically. Now, head to the steps below and download locked PDF files from Google Drive:

Instructions: Head to your web browser and access Google Drive to access the restricted PDF. Double-click the PDF file to open it and press the "Ctrl + Shift + C" keys on the keyboard while using Windows. Then, hit the "Console" tab next to the "Elements." Afterward, paste the given code into the "Console" and hit the "Enter" key on the keyboard. This will download your PDF file automatically.

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

Bonus Tip: How to Unlock Protected PDFs?

It is not easy to download protected PDFs from Google Drive. But you can do it with the methods shown above. Please note that it is illegal to download the protected PDF from others, so only download your own protected PDF.

If you have one protected PDF with a password and want to remove it, you can use the UPDF PDF editor. This tool helps you quickly unlock PDFs containing passwords and then export them in 9 different formats. Here is the download button for you to download to check all its password features.

Windows • macOS • iOS • Android 100% secure

On the other hand, users can even share the PDF via the built-in share feature to send the document either as mail, link, or a bar code. Moreover, when a PDF is unlocked, you can edit it to add, remove, or customize the text. Annotation is yet another great feature offered by this tool, from adding sticky notes to creating customized signatures. Let's move to the next steps and learn how to unlock protected PDFs:

Step 1: Access the PDF File Using UPDF

Launch the UPDF program on your system and import protected PDF via the "Open File" option. In case the PDF is protected with an open password, you will need to "Enter Password" and click the "Unlock" button. This will allow you to access the contents of the PDF file.

Step 2: Remove Security to Unlock the File

Afterward, head to the right-side toolbar, tap the "Protect Using Password" button, and select "Remove Security" from the extended menu on the left side. Following this, tap on the "Remove" button, and if the PDF is protected with a permission password, you will need to "Enter Password" here. At last, "Save" the file anywhere on your system.

Interested in using UPDF to unlock UPDF now? Download UPDF via the below directly.

Windows • macOS • iOS • Android 100% secure

Also Read: How To Print Password Protected PDF?

FAQS About Password Protected PDF in Google Drive

Q1. How do I remove passwords from PDFs using Google Drive?

As previously, you have unprotected the PDF file by entering the password. You can now access the content within PDF. However, to completely remove the password from PDF Google Drive, click the "Print" icon in the upper right corner. This will open your PDF in a new tab, and you will be required to enter the password again and hit "Submit."

Next, click on the "Print" icon and select the "Save As PDF" option from the drop-down list of "Destination." Then, hit the "Save" button, and the document will be saved on your device without any password.

Q2. How do I unprotect a PDF in Google Drive?

Using the search engine on your web browser, such as Google Chrome, access Google Drive. Then, right-click on your Drive's interface and choose the "File Upload" option. Then upload the password-protected PDF there. Now, double-tap the PDF file, enter the file password, and tap on the "Submit" option. This way, your PDF file is now unprotected.

Q3. How to print a locked PDF file in Google Drive protected by Google Drive's sharing settings?

Google Drive offers additional protection features to users, allowing them to restrict others' downloading or printing of their files. You can follow these detailed steps to print a PDF file. First, on your web browser, search for Google Drive to open it.

Then, locate the specific file you want to print in your Google Drive folders and double-click on it to open it. Now, you'll need to access the web developer tools in your browser. Now, simultaneously press "CTRL + Shift + I" to open the web developer tools panel.

Within the web developer tools panel, find and select the "Console" tab. The Console tab is where you can input and execute code. Now, you need to paste the following code into the console:

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

if (!/^blob:/.test(img.src)) {

continue ;

}

let canvasElement = document.createElement( ‘canvas’ );

let con = canvasElement.getContext( "2d" );

canvasElement.width = img.width;

canvasElement.height = img.height;

con.drawImage(img, 0, 0,img.width, img.height);

let imgData = canvasElement.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.3.2/jspdf.min.js' ;

document.body.appendChild(jspdf);

At this point, the print and download options will be visible. Hit the download option to save the PDF file and access it again to see the “Print” option visible.

Final Thoughts

To conclude, downloading protected PDFs from Google Drive can be a simple process for users using the guided steps and exact codes mentioned above. We are sure that you can do it with this guide.

If you need to unlock the protected PDF file, we would like to recommend the UPDF PDF editor to you. This tool improves the PDF management task, and the hassle of removing passwords can be resolved easily. Download it to try now, and learn more about this software by reading a full review on igeeksblog.

Windows • macOS • iOS • Android 100% secure

We use cookies to ensure you get the best experience on our website. Continued use of this website indicates your acceptance of our privacy policy.