Paged.js logo

Paged.js

JavaScript library for paginated browser layouts and print book PDFs using HTML and CSS

Open Source Alternative to
Repository activity
  • Stars1.4k
  • Forks148
  • Open Issues228
License

MIT

Languages
  • HTML
  • JavaScript
  • Dockerfile
Paged.js screenshot

About Paged.js

Paged.js is an open-source library for displaying paginated content in the browser and generating print books with web technology. It targets HTML and CSS workflows where pages, print layout, counters, and generated content need to be previewed before producing output.

It polyfills the CSS Paged Media and Generated Content modules with handlers for CSS transformations and fragmented layout. The Chunker breaks documents into paged media flows and applies print classes, while the Polisher converts @page CSS to classes and applies counters and content. Hooks allow custom handlers for additional properties.

Paged.js is distributed as an NPM module and is licensed under the MIT License. A separate command line interface can render PDFs from HTML files using Puppeteer. Docker can run the development server, while the core library runs as a browser polyfill when the DOM is ready.

Key features

  • Displays paginated HTML content in the browser
  • Generates print books using web technology
  • Polyfills CSS Paged Media and Generated Content modules
  • Chunker creates paged media flows and print classes
  • Polisher converts @page CSS and applies counters and content

Details

First released
2018
Package
NPM module
CSS
Paged Media · Generated Content
PDF
CLI renders HTML via Puppeteer
Runtime
Browser polyfill
License
MIT