@lacspace/pdf
Generate real PDFs — invoices, receipts & documents — with zero dependencies and no headless browser. Accurate text layout, auto page-breaks and batteries-included invoice() & receipt() generators, now with tables, JPEG/raw images, page sizes & landscape, Times/Courier fonts, page numbers, bookmarks and Info metadata. Isomorphic (Node, edge, browser).
npm i @lacspace/pdfUsage
import { invoice } from "@lacspace/pdf";
import { writeFileSync } from "node:fs";
const bytes = invoice({
brand: "Lacspace",
number: "INV-1024",
date: "2026-08-23",
dueDate: "2026-09-06",
from: { name: "Lacspace Corporation", lines: ["Global HQ"], email: "billing@lacspace.com" },
to: { name: "Acme Pvt. Ltd.", lines: ["Kathmandu, Nepal"], email: "accounts@acme.com" },
items: [
{ description: "Custom software development", quantity: 1, rate: 4500 },
{ description: "AI chatbot integration", quantity: 2, rate: 750 },
],
currency: "$", taxRate: 13, discount: 200,
notes: "Payment due within 14 days.",
});
writeFileSync("invoice.pdf", bytes); // Node
// or in a route handler:
return new Response(bytes, { headers: { "content-type": "application/pdf" } });Exports 5
PdfDocumentformatMoneyinvoicereceipttextWidthKeywords
More in Backend Kit
Make any operation exactly-once with an idempotency key — fingerprint the request (reject key-reuse with a different body), replay the stored response on retries, lock in-flight duplicates, and sweep expired records. Framework-agnostic, pluggable store, zero-dependency, isomorphic.
@lacspace/signed-urlHMAC-signed, expiring URLs & tokens over Web Crypto — secure download links, magic-login links, unsubscribe and one-time-action tokens — now with key rotation, method/IP/path binding, single-use nonces, signed claims and clock tolerance. Tamper-proof, timing-safe. Isomorphic (Node, edge, browser).
@lacspace/webhooksThe webhook toolkit for both directions — sign & deliver outgoing webhooks with retries/backoff, verify incoming ones (timing-safe, replay-protected) with Stripe / GitHub / Shopify presets, plus typed event envelopes, exactly-once idempotency and pure endpoint routing. One internal dependency (@lacspace/crypto), isomorphic.