GithubHelp home page GithubHelp logo

google-drive-pdf-downloader's Introduction

Google Drive PDF Downloader

This script will help you to download protected view only PDF files from Google Drive easily.

Features

  • Lets you to download high quality PDF files.
  • Saves all pages individually inside a directory called Pages.
  • Fast download speed.
  • Efficient CPU and RAM usage.
  • Automatically adjusts the page size and orientation according to the source document.
  • Automatic fast scrolling to load all the pages correctly.
  • Supports Windows, Linux etc.

How to use - Method 1

This method is fast, works for all types of scenarios and performance is great!

  1. Download this repository to your computer and unzip it.
  2. Enter the URL of the protected view only PDF File into your browser. (eg: Firefox, Chrome etc.)
  3. Open the script "Method_1_Script.js" and copy all the contents.
  4. Then open the browser web console.
  5. Paste the copied script into the console and press enter.
  6. After few seconds the browser will prompt you to save a file with extension ".PDF_DataFile"
  7. Save this file and copy it into the "Input" directory which is inside the repository you downloaded earlier!
  8. If you are using Windows then navigate to "Windows" directory and double click on "GeneratePDF.cmd", or If you are using Linux then navigate to "Linux" directory and execute "GeneratePDF"
  9. A successful message will be shown once the whole process completes.
  10. Navigate to the "Output" directory and enjoy!

Tips for Method 1

  • You should always give a custom file name by changing the place holder "Document" to "Cool_File_Name" in Method_1_Script.js. Do not include ".pdf" file extension along with the document name here!
let pdfDocumentName = "Document";

Change to this

let pdfDocumentName = "Cool_File_Name"; 
  • By default this script will download PDF file with the highest quality available, but just in case if you need even better quality simply zoom in your browser (eg: 200% to 300%) then follow the above steps to download.
  • The Output directory contains individual PDF directories for efficient organizing and "Pages" directory is present in each one of these.
  • The "Pages" directory contains individual pages of PDF document in .png format.
  • For bulk PDF generation, download all ".PDF_DataFile" for your viewonly PDF documents and copy these inside "Input" directory then double click on "GeneratePDF.cmd" to execute (For Linux execute "GeneratePDF" which is inside the "Linux" directory).
  • During execution of "GeneratePDF.cmd", PDF directory will be creates inside "Output" directory based on the custom "pdfDocumentName" given earlier. If the PDF directory name already present in "Output" directory, then it will ask user's permission to delete it. Just Press "Y" for YES or "N" for NO. If you press N then it will skip processing of that specific ".PDF_DataFile" and it's PDF won't be generated.

How to use - Method 2

Use this method only for PDF with less than 20 pages, if you experience any errors or slow down then follow Method 1

  1. Enter the URL of the protected view only PDF File into your browser. (eg: Firefox, Chrome etc.)
  2. Open the script "Method_2_Script.js" and copy all the contents.
  3. Then open the browser web console.
  4. Paste the copied script into the console and press enter.
  5. After few seconds the browser will prompt you to save the PDF file.
  6. Save the file and enjoy!

Tips for Method 2

  • You should give a custom file name by changing the place holder "Document" to "Cool_File_Name" in "Method_2_Script.js". Do not include ".pdf" file extension along with the document name here!
let pdfDocumentName = "Document";

Change to this

let pdfDocumentName = "Cool_File_Name"; 
  • By default this script will download PDF file with the highest quality available, but just in case if you need even better quality simply zoom in your browser (eg: 130% to 150%) then follow the above steps to download. If you increase the zoom level more than 150% Method_2_Script.js will struggle to generate the PDF.

Author

Inspiration

Inspired from https://codingcat.codes/2019/01/09/download-view-protected-pdf-google-drive-js-code/

Dependencies

  • Used ImageMagick to generate PDF for Method 1
  • Used jsPDF to generate PDF for Method 2

Security Tips!

  • Always be aware of what you paste into the browser console, malicious code can do alot of harm.

google-drive-pdf-downloader's People

Contributors

zeltox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-drive-pdf-downloader's Issues

error Access is denied.

in windows i keep getting the same error /Output/Document : Access is denied.
i try as administrator and i add administrator to theGeneratePDF.exe but no way !!! any solution

Compiling go

I don't know much about the language, can I simply download it and compile the code from main.go or it's somehow more complicated? If it is, could you please facilitate the steps?
Thanks in advance

Error when downloading after update

I think a recent Chrome update broke the downloader. After the scrolling part, it doesn't generate a PDF_DataFile anymore and I get multiple error messages such as VM170:28 Uncaught RangeError: Invalid string length at generatePDF_DataFile (<anonymous>:28:38) at <anonymous>:86:25. The error seems to be referring to this line in Method 1 doc = doc + "\n" + imgDataURL;

I tried Method 2 and it doesn't work from the get-go. unlike Method 1 which still goes through the scrolling process.

Update: It seems like the errors only happen if you zoom the pdf. It works fine if you download the pdf as it is when you open it. Still, I remember it working fine like 2-3 weeks ago regardless of zoom and without zooming, all the files will have low resolution.

Facing issue in Conversion

HI!
First of all this is one thing I needed so thankyou so much. I have been searching for something like this but haven't found anything yet. I should mention that I tried using it on some other site having the same .js images as in Google Drive.
The process goes smoothly with ignorable errors and the file is downloaded. (I changed the URL).
I have tried to convert but it shows the following error
"magick: UnableToOpenBlob '../Output/Disco/Pages/*.png': Invalid argument @ error/blob.c/OpenBlob/3539.
2020/11/03 14:32:15 cmd.Run() failed with exit status 1"

Can you please point me in the direction on what you think cause of the error could be?
Capture

UnableToOpenBlob?

Hi, Very excited about using this product, and all seems fine until I get to GeneratePDF, the following message appears:

image

Method1 works on Mac with Chrome. How to convert to PDF

Thanks for your code.
I work with a Mac.
Could you please suggest how to do the last conversion of the file I have in Input to PDF with a Mac?
Not sure this helps but Imagemagick can be installed for mac with homebrew: brew install imagemagick

invalid png base64 file

Why does "invalid png base64 file found" appear when i try to generate pdf?

'identifier "doc" has already been declared' also shows up in console.

Chrome server was used

Does not work

When attempting to download a Google Slideshow with exports disabled, it wont work

This was tested in Google Chrome & Mozilla Firefox.

In Firefox, there were too many erorrs listed, mostly to do with CORS.

In firefox, i was able to get something working but it woudnt work

(I only used MEthod 1)

  1. I had to change "let doc = "";" to " let something_else=""; "
  2. When I ran it, it did give the download prompt but it downloaded with 0 bytes

Improving Quality

Hi,
I am using your convertor, successfully, but have noticed one issue: If I am using the default google size, - the quality is very poor.
Once I "resize to fit" (middle control icon_ - the quality is much better (file is also larger).
I have experimented with full zoom (the "+" control button - to the max zoom ) - and it produced even larger file with a little bit better quality.

Can you fix your first script , to adjust the size (possibly to "fit" ) before starting to process the pages?

And a quick question - is it possible not to visibly scroll the document during processing? I think it will achieve a faster speed.

Thanks for the useful tool!

Rafi

Error on Method 1

Uncaught SyntaxError: Identifier 'doc' has already been declared

How to fix this error?

Page limit using method 1

I was download a 934 pages pdf document, but i was only able to download 846 pages which is equivalent to 8588 ticks in the command panel, so is there a way to increase the limit or should i just divide my pdf??

It work great for 3 pdf then it suddenly stop working at 70-80%

It auto scroll & save perfectly for the first 3 file i use it but then the next one it stop when reach around 70-80% of the file

https://i.imgur.com/KOvXY4J.jpeg

Like this it stop at 928 but this one have 1304 page dunno why

I have to scroll it myself for the rest of the page and use another code to download them

or you can provide me the code for auto scroll only would be nice too since it work really great and i can play the game and do anything else while it auto scrolling

Pull request for nodejs script

Hi,

I am not able to run the Linux program on my Mac, so I wrote a script in node to generate the pdf file. It would be great if I can create a pull request and share it with other ppl who may have the same issue as mine.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.