2026-06-19 17:47:29 +02:00
2026-06-19 15:49:54 +02:00
2026-06-19 15:27:27 +02:00
2026-06-19 00:21:02 +02:00
2026-06-19 15:27:27 +02:00
2026-06-19 15:27:27 +02:00
2026-06-19 16:03:13 +02:00

pdfy

Convert web articles to PDF using the Reader View Chrome extension and headless Chrome (Puppeteer).

Features

  • Extracts article content via Mozilla Readability
  • Renders using Reader View for clean typography
  • Supports all Reader View themes: light, dark, sepia, groove-dark, solarized-light, solarized-dark, nord-light, nord-dark
  • Custom CSS injection
  • Syntax highlighting via highlight.js
  • Automatic reading time estimation
  • Configurable extension preferences

Installation

npm install

Extract the Reader View extension (get it using CRX Downloader):

mkdir -p extension/reader-view
unzip extension/Reader-View-Chrome-Web-Store.zip -d extension/reader-view

Usage

node src/index.js --help
Usage: pdfy [options] <url>

Arguments:
  url                      URL of the article to convert

Options:
  -t, --theme <theme>      Reader View theme (light, dark, sepia, groove-dark, solarized-light, solarized-dark, nord-light, nord-dark)
  -c, --css <path>         path to custom CSS file
  -p, --prefs <path>       path to extension preferences JSON
  -o, --output <path>      output file path (default: ./output/<title>.pdf)
  -l, --log-level <level>  logging level (fatal, error, warn, info, debug)
  -h, --help               display help for command

Examples

node src/index.js https://example.com/article
node src/index.js https://example.com/article --theme dark --css config/rules.css
node src/index.js https://example.com/article --prefs config/reader-view-preferences.json
npm start -- https://example.com/article --theme dark --css config/rules.css

Running tests

npm test

The test script reads URLs from src/test/test.txt and runs multiple scenarios (default, dark, sepia, custom CSS, etc.).

Credits

Description
Convert web articles to clean PDFs via Reader View and headless Chrome
Readme 186 KiB
Languages
JavaScript 97.7%
Dockerfile 2.3%