How To Download Google Drive Pdf
The owner of the file has the power to disable the download option for a shared file. This means you can only view the file as a preview in your browser or Google Drive app, but there will be no download button. Now, if you wish to download the View Only Protected PDF from Google Drive, you can implement a small JS Code in your browser to download the file.
Similarly, you can download view-only protected Google Drive Video and Google Docs using separate methods. But today, in this post, I will highlight how you can download PDF files without a download option.
It is interesting to note that Google Drives splits the pdf into separate images as a Blob, and when the download is requested, then it compiles the images together and gives you a PDF to download. Therefore it is not very easy to download the restricted PDF from Google Drive. But you can use JS code into your Chromes Dev tool to download the file as a PDF with only a few clicks.
Steps to Download Restricted Google Drive PDF
Here are the Simple Steps to Download View Only Protected PDF from Google Drive Using Chrome Browser
- Open the PDF file on your Chrome Browser.
- Let the file load completely.
- Scroll to the bottom of the page.
- Now open Developer Console by pressingCtrl + Shift + C for Windows orCmd + Shift + C for Mac.
- Click on Console Tab.
- Now paste the JS code (Below) in the console and hit Enter.
- Done! The PDF file will be downloaded.
JavaScript 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("download.pdf");
};
jspdf.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js';
document.body.appendChild(jspdf);
Alternative Method 1
The above JS method works for Simple PDF files, but if you wish to download Large PDF files with complex orientation in HD quality, then the simple JS code may not work that great, here you can try this advanced trick to save the download protected Google Drive PDF.
Use this method only if the above method does not give you desired PDf File
- Download the Zip file and extract the content.
- Open Method_1_Script.js.
- Copy the JS Code.
- Now open the PDF File.
- Go to Dev Console and Paste the copied JS Code, and hit enter. (You can change the file name in the Script
let pdfDocumentName = "BytesBin_PDF";
)
- The script will self-scan all the pages and download PDF_DataFile.
- Now copy and paste the DataFile in the Input folder of the Extracted Zip.
- If you are using Windows, then navigate to the "Windows" folder and double click on "GeneratePDF.cmd" or if you are using Linux, then navigate to the "Linux" folder and execute "GeneratePDF".
- A successful message will be shown once the whole process completes.
- A new output folder will be generated, navigate to the "Output" directory to check your created PDF.
- Done! 😀
Alternative Method 2
Use This method if PDF with less than 20 pages
- Open the URL of the protected view-only PDF File into your browser.
- Open the script"Method_2_Script.js" and copy all the JS Code.
- Open the browser web console.
- Paste the copied script into the console and press enter.
- The script will scan all the pages and after few seconds, the browser will prompt you to save the PDF file.
- Save the file and enjoy! 😀
Frequently Asked Questions (F.A.Q)
Can I Download View Only PDF from Google Drive?
Yes! You can download View Only Protected PDF from Google Drive using a JavaScript Code that complies the PDF images into a Single PDF File to Download.
Why Download Button is Missing for PDF in Google Drive?
If the Download Button is Missing for a PDF file in Google Drive then the Owner of the File has Set Download Restriction for the file to Prevent it from Downloading.
How to Download Protected Google Drive PDF Shared with me?
If the PDF File is Disabled for Download, then you Cannot Save it. You Need to Run a Script from Browser Console to Save the PDF File.
Why Download Option Missing from Google Drive App for Android?
The owner of the file has disabled the download permission for the file, you cannot download the PDF file directly.
Conclusion
With this simple guide above, you can Save the Download Protected Google Drive PDF File. The method best works for the Desktop browser.
Source: https://bytesbin.com/download-view-only-pdf-google-drive/
Posted by: andresandressanyaroe0269021.blogspot.com
Post a Comment for "How To Download Google Drive Pdf"