zeltox / Google-Drive-PDF-Downloader

MIT License
435 stars 124 forks source link

Support of larger documents #15

Open DelieverThibaut opened 2 years ago

DelieverThibaut commented 2 years ago

The doc variable has a limited length. The script crashes when the document becomes too large. my work around: I surround the append code section of the existing function with a try block and store the last successful imgTag in the variable 'imgCount'. If 'imgCount' is less than the number of 'imgTags' then we know that we have to start over but at the first tag where it went wrong before aka the 'imgCount'. With this method, the user has multiple '.PDF_DataFile' files after execution of the script which can be easily converted to PDF by the existing scripts. All that needs to be done at the end is a merge of all PDF files, which can be done very easily online.

I've also implemented a variable 'earlyStop'. If the user wants to stop the scan early, all they need to do is set this boolean to true in the console of the browser. The scanning process will stop and the conversion will begin.

This code worked in my case (google doc with 900+ pages). Test my addition to make sure it performs to your liking.