# Paged\.js

JavaScript pagination library for previewing and producing print\-oriented documents with browser technology\.

ID: Q305 · Revision: 291

Type: software · License: MIT[^picture] · Status: active

Website: https://pagedjs.org/



Paged\.js is a JavaScript library that paginates HTML content for print\-oriented output\. It translates supported paged\-media CSS into structures and styles a browser can render, providing an on\-screen page preview that can be saved as PDF\. It is an MIT\-licensed library with an associated command\-line renderer, rather than a standalone desktop publishing editor\.[^picture][^repo][^cli]

## A browser\-centered workflow

The library fragments content into pages and presents the result in a browser, allowing a designer to inspect the layout with familiar browser tools\. Its polyfill approach implements selected print\-oriented behavior on top of browser rendering rather than replacing the entire browser engine\. This workflow can be useful for documents authored as HTML, but should not be confused with importing an arbitrary desktop\-publishing project\.[^picture]

## Preparing content before pagination

The repository exposes a Previewer interface and a polyfill that normally starts after the document is ready\. Applications can delay that start with an asynchronous preparation step or invoke pagination explicitly\. Handler hooks also allow custom work during parsing and layout\. These controls matter when content needs preparation before pages are formed; changing the input after pagination is a separate concern from producing a completed preview\.[^repo]

## Generated navigation content

CSS\-generated content can add labels, counters and printed link text without placing those strings directly in the source content\. Paged\.js's documentation connects this approach with running headers, page numbers and cross\-references for paginated documents\. Such layout\-generated material belongs to the output presentation\. A reusable content source and its final paginated reading aids should therefore be treated as related but distinct artifacts\.[^generated]

## Command\-line rendering and resources

The associated command\-line project combines Paged\.js with Puppeteer to render HTML as PDF\. It exposes options for timeouts, page dimensions, additional scripts and controlling access to local or remote resources\. This makes browser automation part of the production environment\. The documented controls provide configuration choices, not proof that an untrusted document is safe under every default deployment\.[^cli]

## Substitution considerations

Paged\.js can substitute for [WeasyPrint](/weasyprint) for compatible HTML/CSS publishing jobs when a browser\-based preview and rendering workflow is desired\. WeasyPrint uses its own Python pagination engine, so matching the input language does not imply matching layout, dependencies or extension behavior\. A switch should compare the required print features and actual output, retaining control of when pagination begins and which resources the renderer may access\.[^picture][^repo][^cli][^weasy]

## Capabilities and substitutions

### Browser pagination preview — supported

Paginates HTML using a browser and supported paged\-media transformations\.[^picture]

Use case: Browser\-based HTML/CSS pagination and PDF production · Platforms: Web browsers, Node\.js CLI with Puppeteer · Region: Version, build and integration requirements apply

### Pagination timing control — supported

Automatic start can be delayed by a promise or disabled for explicit preview initiation\.[^repo]

Use case: Browser\-based HTML/CSS pagination and PDF production · Platforms: Web browsers, Node\.js CLI with Puppeteer · Region: Version, build and integration requirements apply

### Automated PDF output — limited

Associated CLI uses Puppeteer; browser runtime and resource policy are deployment requirements\.[^cli]

Use case: Browser\-based HTML/CSS pagination and PDF production · Platforms: Web browsers, Node\.js CLI with Puppeteer · Region: Version, build and integration requirements apply

### [Substitute for WeasyPrint](/weasyprint) — limited

Can cover suitable HTML/CSS\-to\-PDF pagination through browser technology; runtime and supported layout behavior differ\.[^picture][^cli][^weasy]

Use case: Browser\-based HTML/CSS pagination and PDF production · Platforms: Web browsers, Node\.js CLI with Puppeteer · Region: Version, build and integration requirements apply

## References

[^picture]: [Paged\.js overview](<https://pagedjs.org/en/documentation/1-the-big-picture/>) — Browser pagination, preview, polyfill and MIT license (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^repo]: [Paged\.js repository](<https://github.com/pagedjs/pagedjs>) — Previewer, automatic start control and asynchronous handlers (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^generated]: [Paged\.js generated content](<https://pagedjs.org/en/documentation/6-generated-content/>) — Counters, generated text and paged navigation content (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^cli]: [Paged\.js command\-line renderer](<https://github.com/pagedjs/pagedjs-cli>) — Puppeteer PDF output, timeouts and resource access options (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^weasy]: [WeasyPrint engine overview](<https://doc.courtbouillon.org/weasyprint/stable/>) — Separate Python HTML/CSS pagination engine (vendor; retrieved 2026-10-07T12:42:28.193Z)

Source revision: https://substitutefor.net/entities/Q305?revision=291
