Skip to content

Instantly share code, notes, and snippets.

View RobinDeBaets's full-sized avatar
🗽
💯

- RobinDeBaets

🗽
💯
View GitHub Profile
@RobinDeBaets
RobinDeBaets / pdfdownload.js
Created February 28, 2023 22:13
This script allows you to download view-only PDF's on Google Drive. Simply open the document, scroll through it until all pages are loaded and then execute this script in your browser console. This script has some improvements compared to other scripts and avoids blur on high-resolution images.
let pdfScript = document.createElement("script");
function rescale(width, height, fitWidth, fitHeight) {
let ratio = width / height;
let fitRatio = fitWidth / fitHeight;
if (ratio <= fitRatio) {
// Dimensions to fit are wider, fix the width
return [width, width / fitRatio];
} else {
// Dimensions to fit are taller, fix the height
return [height * fitRatio, height];