npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lp-labs/document-print-layout

v0.1.0

Published

Point-based simplex, duplex and signature booklet imposition with real sheet page plans.

Readme

@lp-labs/document-print-layout

Point-based simplex, duplex and signature booklet imposition with real sheet page plans.

Original, independent MIT implementation. Zero runtime, peer or sibling dependencies. Requires Node.js 18+; strict TypeScript declarations support both ESM and CommonJS.

Install

npm install @lp-labs/document-print-layout

Quickstart

import { planPrint } from '@lp-labs/document-print-layout';
const plan = planPrint({
  pages: 8,
  sheet: { width: 842, height: 595 },
  margins: { top: 10, right: 10, bottom: 10, left: 10 },
  mode: 'booklet',
  signature: 8,
});
if (JSON.stringify(plan[0].slots.map((s) => s.page)) !== '[8,1]' || plan[0].slots[0].width !== 411)
  throw new Error('Imposition mismatch');

API and types

planPrint(options: PrintOptions): PrintSide[] returns sheet numbers, signature numbers, front/back sides and PrintSlot rectangles with page number or null blank and rotation 0/180. PrintOptions requires pages, sheet width/height, margins top/right/bottom/left; optional mode simplex (default), duplex or booklet, signature size (default 16, multiple of 4), binding left/right, flip long-edge/short-edge. Booklets pad the final signature to a multiple of four; each sheet has two slots per side and nested outer/inner page ordering. Ordinary duplex emits an explicit blank back for an odd page count.

Customize

Set sheet and asymmetric margins for your device, mode for duplex/booklet, signature for folding batches and binding to reverse left/right logical page pairs. Map these explicit plans into your injected renderer.

Errors and bounds

1..10,000 source pages; dimensions at most 100,000; positive printable area; signature 4..128. O(pages) time/output. Coordinates are physical top-left sheet points. Back-side coordinates use their own top-left face; short-edge flip applies 180-degree slot-content rotation, not swapped slot coordinates. Plans do not render or send data to a printer, perform color management, creep compensation or determine device-specific feed transforms. Unlike document-pagination, this imposes existing logical pages onto physical sheets.

Invalid runtime inputs throw TypeError/RangeError or the documented typed error. Adapter errors propagate unchanged unless specifically noted; asynchronous methods reject. Inputs must be ordinary typed data, not hostile proxies or accessors. No I/O happens at import time. All runtime exports are documented above and the example executes without optional packages.

Development

npm ci --offline --ignore-scripts --no-audit --no-fund
npm run build
npm run typecheck
npm test
npm run format:check

Build emits dist/esm and dist/cjs with matching declarations. Tests use Node's test runner; consumer.mts and consumer.cts validate meaningful bare-package imports and expected type errors. Only TypeScript ^5.9.3 and Prettier ^3.6.2 are development dependencies.

Support

If this library is useful to you, consider supporting its maintenance with a donation via PayPal.

Author

Created by Libin Prasanth. Connect on LinkedIn for updates and discussion.