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

@ferrow/pdf-generator

v2.0.0

Published

Minimal text-and-lines PDF 1.4 writer built from scratch, zero dependencies. Helvetica core font, multi-page, mm/pt units.

Readme

pdf-generator

CI

A minimal text-and-lines PDF writer, built from scratch — no bindings, no embedded binaries, zero dependencies. It emits valid PDF 1.4 byte-for-byte: catalog, pages, page, font, and content-stream objects, an exact xref table (byte offsets computed while writing, not estimated), and a trailer.

What this is

  • Multi-page documents (addPage()).
  • Text placement at (x, y) with a size, using the core Helvetica font (no font embedding — Helvetica is one of the 14 standard PDF fonts every reader already has).
  • Straight lines (line(x1, y1, x2, y2)).
  • mm() / pt() unit helpers (PDF's native unit is points; 1mm = 72/25.4pt).
  • Correct xref offsets, verified by file reporting a valid PDF document, version 1.4, N pages and by startxref pointing at the real xref byte.

What this is NOT

  • No images, no embedded/custom fonts, no Unicode (Helvetica + WinAnsi-range text only — escapes \, (, ); does not transcode wide characters).
  • No compression, encryption, forms, or annotations.
  • Not a layout engine — no word wrap, no flow, you place text and lines by coordinate. For anything beyond plain text-and-lines, use pdfkit or pdf-lib.

Quickstart

npm install
npm run build
node dist/examples/demo.js

API

import { PdfDocument, mm } from 'pdf-generator';

const doc = new PdfDocument(); // defaults to A4; pass { pageSize } for Letter, etc.

const page = doc.addPage();
page.text(mm(20), page.size.height - mm(20), 'Hello, PDF', { size: 18 });
page.line(mm(20), page.size.height - mm(25), mm(190), page.size.height - mm(25));

const buffer = doc.toBuffer(); // Node Buffer, valid PDF 1.4
require('fs').writeFileSync('out.pdf', buffer);

Coordinates are in points with the PDF-native origin at the page's bottom-left corner (not top-left).

Demo

examples/demo.ts generates a 2-page PDF and verifies the output:

$ node dist/examples/demo.js
header: %PDF-1.4
size: 985 bytes
contains text: true

$ file dist/examples/demo-output.pdf
dist/examples/demo-output.pdf: PDF document, version 1.4, 2 pages

License

MIT


Sponsored by Ferrow


Part of the ferrow-toolkit collection · Sponsored by Ferrow