Skip to content

Chrome Extension that monitor your network request for PDF files and download them.

Notifications You must be signed in to change notification settings

TXHENG/pdf-download-browser-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Interceptor

PDF Interceptor is a lightweight Chrome extension that spots PDF responses as you browse. It flashes a floating Download PDF button inside the page for manual downloads, and—when "auto mode" is enabled—grabs the file automatically as soon as the network request completes, then closes the tab.

Features

  • Detects PDF requests on any site using a Manifest V3 background service worker
  • Manual download button injected via content.js with inline styling that avoids host-page conflicts
  • Auto mode toggle exposed in the extension popup (popup.html / popup.js)
  • Auto downloads tracked in the background so authenticated PDFs continue to work, followed by automatic tab closure

Repo Layout

File Purpose
manifest.json Declares metadata, permissions (webRequest, tabs, downloads, storage), action popup, and content script wiring
background.js Service-worker context that tracks last PDF per tab, relays messages, and executes auto downloads
content.js Injected script that renders the floating button and forwards clicks back to the background worker
popup.html / popup.js Popup UI that lets users toggle auto mode and persists the state with chrome.storage.local
AGENTS.md Contributor guidelines and coding conventions

Getting Started

  1. Clone the repo locally.
  2. Open chrome://extensions, enable Developer mode, and click Load unpacked.
  3. Select the repository root. The extension icon should appear in the toolbar.
  4. Click the icon to open the popup and toggle Auto Mode on or off. The state persists via chrome.storage.

Manual Workflow

  • Browse to any link that ends in .pdf (or serves application/pdf).
  • When the button appears, click Download PDF to trigger a background download.

Auto Mode Workflow

  • Enable auto mode in the popup.
  • Open a PDF link in a new tab; the background worker downloads it instantly.
  • Once Chrome reports the download as complete, the tab is closed automatically. Interrupted downloads remove the tab from the queue without closing it.

Packaging for Release

zip -r dist/pdf-interceptor.zip manifest.json background.js content.js popup.html popup.js

Upload the archive to the Chrome Web Store dashboard. Remember to increment the version field in manifest.json first.

Testing Checklist

  • Manual PDF download appears and works on both public and authenticated pages
  • Auto mode downloads and closes the correct tab without affecting others
  • Button hides on non-PDF pages and reappears when revisiting a PDF tab (via GET_LAST_PDF)
  • Multiple PDF tabs operate independently (check lastPdfByTab separation)

Contributing

See AGENTS.md for style conventions, commit expectations, and security tips. PRs should list the manual scenarios executed and highlight any permission changes.

About

Chrome Extension that monitor your network request for PDF files and download them.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published