Downloads pages from Digitální Knihovna as numbered PNG files. Available as a Chrome extension (recommended) or a browser console script.
Warning: Only works on documents accessible with your current login — e.g. via university library access. DO NOT distribute downloaded pages. The scraper just automates what would otherwise take hours of manual screenshots.
Note: Digitální Knihovna servers can be slow or unresponsive, and your login session may drop mid-run. If the scraper stalls or stops, just restart it from the last successfully downloaded page.
Output: Individual PNG files (page_0001.png, ...). To combine them into a PDF, use merge_pngs_to_pdf.py.
- Open Chrome and go to
chrome://extensions/ - Enable Developer mode (top right toggle)
- Click Load unpacked and select the
chrome_extension/folder
- Open a book in Digitální Knihovna
- Click the DK Scraper extension icon
- Set Start page (default: 1) and optionally Total pages (leave blank to download all)
- Click Start — pages will be saved to your Downloads folder as
page_0001.png,page_0002.png, etc. - Click Stop at any time to abort
The popup shows live status (Running — page N…) and updates automatically when the run finishes.
Double-page spreads are saved as two files per spread: page_0001_a.png and page_0001_b.png. Therefore page number you choose should represent numbered page of the last file you downloaded.
The helper script merge_pngs_to_pdf.py merges downloaded page_*.png files into one PDF.
Install the Python dependency once:
python3 -m pip install PillowFrom the folder containing the downloaded PNG files, run:
python3 /path/to/digitalni\ knihovna\ scraper/merge_pngs_to_pdf.py -o output.pdfBy default, the script removes empty scanner background around each page. This is useful for double-page spread files such as page_0001_a.png and page_0001_b.png, where one side can contain only empty black/white background.
Additional crop modes:
# exact 50% split: a keeps the left half, b keeps the right half
python3 /path/to/digitalni\ knihovna\ scraper/merge_pngs_to_pdf.py --crop-mode half -o output.pdf
# no cropping
python3 /path/to/digitalni\ knihovna\ scraper/merge_pngs_to_pdf.py --crop-mode none -o output.pdf
# keep more border around detected content
python3 /path/to/digitalni\ knihovna\ scraper/merge_pngs_to_pdf.py --margin 30 -o output.pdfThis python script is AI generated, so if there's something wrong, let me know.
For one-off use without installing the extension.
- Open a book in Digitální Knihovna
- Open DevTools (
F12orCmd+Option+I) → Console tab - Paste the contents of
console_script.jsand press Enter - Start the scraper:
start() // download all pages starting from page 1
start(5) // start from page 5, download all remaining
start(1, 20) // download 20 pages starting from page 1- To stop early:
stop()Edit the config object at the top of the script before pasting:
| Option | Default | Description |
|---|---|---|
startPage |
1 |
Starting page number (also sets filename numbering) |
totalPages |
Infinity |
How many pages to download before stopping |
xhrIdleDelay |
2000 |
ms to wait after last XHR activity before capturing |
stabilityPollInterval |
600 |
ms between canvas stability checks |
stabilityRequiredMatches |
3 |
Consecutive identical snapshots required before saving |