Show HN: PDF Recover – Chrome extension for yanking PDFs out of webpages

unprovable1 pts0 comments

GitHub - unprovable/PDFRecover: Chrome Extention to Recover streamed PDFs from web tabs · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

unprovable

PDFRecover

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>1 Commit<br>1 Commit

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

background.js

background.js

manifest.json

manifest.json

rescuer.html

rescuer.html

rescuer.js

rescuer.js

View all files

Repository files navigation

PDF Recover

Ever had a PDF in a page that you can't save because the button isn't there but... the PDF clearly is? Intended for backing up important documents where the only access is via some web UI'd CDN or similar.

This is a small Chrome extension for recovering PDFs that a web page loads as a stream of byte-range chunks rather than a single downloadable file. It captures the chunked responses as they arrive, reassembles them in byte order, and presents the complete PDF as a download.

Typical use case: a document viewer (PDF.js or similar) streams a PDF from a CDN you can no longer access directly, but the page itself still loads it. As long as the browser can fetch the chunks one more time, this tool can rebuild the file.

How it works

Chrome extensions cannot read response bodies through the normal webRequest API, so this tool uses the chrome.debugger API (the same protocol DevTools uses) to:

Attach to a tab you choose and watch its network traffic.

Record every response whose URL contains .pdf or whose MIME type is a PDF.

Pull each response body (delivered as base64) via Network.getResponseBody.

Parse each chunk's Content-Range: bytes start-end/total header.

Decode the chunks and write each one into a buffer at its correct byte offset.

Save the assembled buffer as a .pdf once coverage is complete.

Plain (non-chunked) 200 responses are handled too — those are simply saved whole.

Project structure

manifest.json - MV3 manifest: permissions (debugger, tabs, )

background.js - Service worker: opens the tool page when you click the icon

rescuer.html - The tool's UI (tab picker, capture controls, results table)

rescuer.js - Capture, Content-Range parsing, reassembly, gap-filling, saving

All captured data lives in the tool page itself, so keep that tab open until you've saved your file. Closing it discards everything captured so far.

Installation

Download and unzip the extension folder.

Open chrome://extensions in Chrome (or any Chromium-based browser such as Edge or Brave).

Enable Developer mode (toggle in the top-right corner).

Click Load unpacked and select the pdf-stream-rescuer folder.

Pin the extension if you like — clicking its toolbar icon opens the tool.

Usage

Open the page that displays the PDF in one tab.

Click the extension icon — the PDF Recover tool opens in a new tab.

In the tool, pick the target tab from the dropdown (hit ↻ Refresh tabs if it isn't listed).

Click Start capture . A "…is debugging this browser" banner appears on the target tab — this is expected.

Reload the target tab. Capture only sees requests made after it starts; it cannot recover chunks from earlier page loads.

Watch the table in the tool fill up with detected PDFs, chunk counts, and coverage.

When coverage shows complete , click Assemble & save . The rebuilt PDF downloads like any normal file.

Important: scroll through the whole document

Most in-browser PDF viewers lazy-load the file — they only request the byte ranges needed for the pages you've actually looked at. If you reload and immediately try to save, you'll usually only have the first few pages' worth of bytes.

Two ways to reach 100% coverage:

Scroll through the entire document in the viewer, start to finish (jumping to the last page helps too). The coverage column updates live, so keep going until it reads complete.

Click "Fill gaps" — the tool requests any missing byte ranges directly from the captured URL using your current browser session. If the server still honors those...

tool page chrome rescuer file click

Related Articles