PDF.js Direct Downloader

Adds a download button to PDF.js viewers that saves the original PDF file

Author
skl49
Daily installs
0
Total installs
0
Ratings
0 0 0
Version
1.0
Created
2025-08-18
Updated
2025-08-18
Size
1.88 KB
License
MIT
Applies to
All sites

PDF.js Direct Downloader

PDF.js Direct Downloader adds a convenient Download PDF button to any webpage that uses PDF.js as its PDF viewer.

Normally, some websites hide or disable the download option in PDF.js, making it difficult to save the original file. This script fixes that by injecting a button that lets you download the currently opened PDF directly from your browser.


✨ Features

  • ✅ Detects if a page is using PDF.js
  • ✅ Adds a floating “Download PDF” button in the top-right corner of the screen
  • ✅ Saves the PDF as a file (document.pdf) with one click
  • ✅ Works even if the site’s native download button is disabled or hidden
  • ✅ Lightweight and runs automatically

📌 How It Works

  • The script waits until PDF.js is loaded on the page.
  • Once detected, it inserts a custom button in the corner of the viewer.
  • When clicked, it uses the PDF.js API to extract the binary PDF data and triggers a browser download.
  • The file will be saved as document.pdf by default.

⚠️ Limitations

  • Currently, the filename is always document.pdf.
  • Some websites may override or customize PDF.js in ways that break detection.
  • If a site doesn’t use PDF.js, the button will not appear.

🛠️ Compatibility

  • Works in Chrome, Firefox, Edge, and other browsers with Tampermonkey.
  • Should work on any website that embeds PDFs with PDF.js.