{"_id":"tinypdf","_rev":"5-e9ebfd9b1dc3461628a54602ab3dd20e","name":"tinypdf","dist-tags":{"latest":"0.4.1"},"versions":{"0.1.0":{"name":"tinypdf","version":"0.1.0","keywords":["pdf","pdf-generator","pdf-creation","document","minimal","zero-dependencies"],"author":"Lulzx","license":"MIT","_id":"tinypdf@0.1.0","maintainers":[{"name":"lulzx","email":"wiserishabh@gmail.com"}],"homepage":"https://github.com/Lulzx/tinypdf#readme","bugs":{"url":"https://github.com/Lulzx/tinypdf/issues"},"dist":{"shasum":"7743358f535439aa0b61c1ef11ad72d3621a1bd2","tarball":"https://registry.npmjs.org/tinypdf/-/tinypdf-0.1.0.tgz","fileCount":6,"integrity":"sha512-gK+vveW5JZsHCnQXuH4MsRjeHqppzwqqv80VAcBuUuJUnXwD+32rPK9vaZFHQ4SbU7RYyQKK02XO6WRjODE/1g==","signatures":[{"sig":"MEUCIA4Nxg1vR7/kLNrtnB9K9NmcqEd4hO2QFYVNSDB+dEGAAiEArWQZPZiIYAWDZhnMEkCgSqZQtksL9kNs8KqvPg9ZT1c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22710},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"7743358f535439aa0b61c1ef11ad72d3621a1bd2","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"bun build ./src/index.ts --outdir ./dist --target node && bun run build:cjs && bun run build:types","build:cjs":"bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist src/index.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"lulzx","email":"wiserishabh@gmail.com"},"_integrity":"sha512-gK+vveW5JZsHCnQXuH4MsRjeHqppzwqqv80VAcBuUuJUnXwD+32rPK9vaZFHQ4SbU7RYyQKK02XO6WRjODE/1g==","repository":{"url":"git+https://github.com/Lulzx/tinypdf.git","type":"git"},"_npmVersion":"10.8.3","description":"Minimal PDF creation library. <400 LOC, zero dependencies, makes real PDFs.","directories":{},"_nodeVersion":"24.3.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/tinypdf_0.1.0_1766083666352_0.19704843719209775","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"tinypdf","version":"0.2.0","keywords":["pdf","pdf-generator","pdf-creation","document","minimal","zero-dependencies"],"author":"Lulzx","license":"MIT","_id":"tinypdf@0.2.0","maintainers":[{"name":"lulzx","email":"wiserishabh@gmail.com"}],"homepage":"https://github.com/Lulzx/tinypdf#readme","bugs":{"url":"https://github.com/Lulzx/tinypdf/issues"},"dist":{"shasum":"0c4a11727b41755ec462bf994c4523c916177895","tarball":"https://registry.npmjs.org/tinypdf/-/tinypdf-0.2.0.tgz","fileCount":6,"integrity":"sha512-aibbpmR/VdIZSWf9wbx2QWnie6ed2XemZpFHKUAa7v4LPTa8/kfWBmRObpPa4CUX3OJSzGyq0s4TJNb9CfjCLA==","signatures":[{"sig":"MEUCIQD1bFvAXcXFeOxh3b5KgxOm9ZWxlwasPMpLjMsEylK5QAIgWtZsJF8lzkDbfuxlp9hYkfdQSPP2l9/Q5dPToqLpoPk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32935},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"0c4a11727b41755ec462bf994c4523c916177895","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"bun test","build":"bun build ./src/index.ts --outdir ./dist --target node && bun run build:cjs && bun run build:types","build:cjs":"bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist src/index.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"lulzx","email":"wiserishabh@gmail.com"},"_integrity":"sha512-aibbpmR/VdIZSWf9wbx2QWnie6ed2XemZpFHKUAa7v4LPTa8/kfWBmRObpPa4CUX3OJSzGyq0s4TJNb9CfjCLA==","repository":{"url":"git+https://github.com/Lulzx/tinypdf.git","type":"git"},"_npmVersion":"10.8.3","description":"Minimal PDF creation library. <400 LOC, zero dependencies, makes real PDFs.","directories":{},"_nodeVersion":"24.3.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/tinypdf_0.2.0_1766415676221_0.42487126701569644","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"tinypdf","version":"0.3.0","keywords":["pdf","pdf-generator","pdf-creation","document","minimal","zero-dependencies"],"author":"Lulzx","license":"MIT","_id":"tinypdf@0.3.0","maintainers":[{"name":"lulzx","email":"wiserishabh@gmail.com"}],"homepage":"https://github.com/Lulzx/tinypdf#readme","bugs":{"url":"https://github.com/Lulzx/tinypdf/issues"},"dist":{"shasum":"7e7b00ac7b89e85e3d3d62dafe0bdb4017e77db1","tarball":"https://registry.npmjs.org/tinypdf/-/tinypdf-0.3.0.tgz","fileCount":6,"integrity":"sha512-QKFs3ZaMUXTf6EyIHKJ+VFEemkfoRByb3dl/7l4yAsqUwM6NRHSveVq8WLlPI/pk0BIaXgMswQpnjgJDNGAdHw==","signatures":[{"sig":"MEQCIH8JEDwYp0w0eozvEf9X9WF5MVQF+Sax70+J7QtTm/7FAiBeo66YZ52kwzbS3UytqhoF6hZCmNafJIGZZU9Y/TwsYA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34783},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"7e7b00ac7b89e85e3d3d62dafe0bdb4017e77db1","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"bun test","build":"bun build ./src/index.ts --outdir ./dist --target node && bun run build:cjs && bun run build:types","build:cjs":"bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist src/index.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"lulzx","email":"wiserishabh@gmail.com"},"_integrity":"sha512-QKFs3ZaMUXTf6EyIHKJ+VFEemkfoRByb3dl/7l4yAsqUwM6NRHSveVq8WLlPI/pk0BIaXgMswQpnjgJDNGAdHw==","repository":{"url":"git+https://github.com/Lulzx/tinypdf.git","type":"git"},"_npmVersion":"10.8.3","description":"Minimal PDF creation library. <400 LOC, zero dependencies, makes real PDFs.","directories":{},"_nodeVersion":"24.3.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/tinypdf_0.3.0_1766589662739_0.11334811910936637","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"tinypdf","version":"0.3.1","keywords":["pdf","pdf-generator","pdf-creation","document","minimal","zero-dependencies"],"author":"Lulzx","license":"MIT","_id":"tinypdf@0.3.1","maintainers":[{"name":"lulzx","email":"wiserishabh@gmail.com"}],"homepage":"https://github.com/Lulzx/tinypdf#readme","bugs":{"url":"https://github.com/Lulzx/tinypdf/issues"},"dist":{"shasum":"489d221ca07bc5c75f5eb41046acd177b0a9590b","tarball":"https://registry.npmjs.org/tinypdf/-/tinypdf-0.3.1.tgz","fileCount":6,"integrity":"sha512-evwxwl+t2X/YG7GYH6HYuXun8H2nCDf2iw6SsFq6QK5/22yziyT3pRi1zvE6ppL1uGh9i2idFx7vzDyWavqODQ==","signatures":[{"sig":"MEUCIAFTESwytcC8QGXcRHeTUUDJZ8qpVY+vsdwDfFrhk3w3AiEAomQxaPnH7oalYXYd+jMkobXlG04CFqYGu22wiEuzKYI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35163},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"489d221ca07bc5c75f5eb41046acd177b0a9590b","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"bun test","build":"bun build ./src/index.ts --outdir ./dist --target node && bun run build:cjs && bun run build:types","build:cjs":"bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist src/index.ts","prepublishOnly":"bun run build"},"_npmUser":{"name":"lulzx","email":"wiserishabh@gmail.com"},"_integrity":"sha512-evwxwl+t2X/YG7GYH6HYuXun8H2nCDf2iw6SsFq6QK5/22yziyT3pRi1zvE6ppL1uGh9i2idFx7vzDyWavqODQ==","repository":{"url":"git+https://github.com/Lulzx/tinypdf.git","type":"git"},"_npmVersion":"10.8.3","description":"Minimal PDF creation library. <400 LOC, zero dependencies, makes real PDFs.","directories":{},"_nodeVersion":"24.3.0","_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/tinypdf_0.3.1_1771189105424_0.6247885105636599","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"tinypdf","version":"0.4.1","description":"Minimal PDF creation library. <400 LOC, zero dependencies, makes real PDFs.","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"bun build ./src/index.ts --outdir ./dist --target node && bun run build:cjs && bun run build:types","build:cjs":"bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist --project tsconfig.json","test":"bun test","prepublishOnly":"bun run build"},"keywords":["pdf","pdf-generator","pdf-creation","document","minimal","zero-dependencies"],"author":{"name":"Lulzx"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Lulzx/tinypdf.git"},"bugs":{"url":"https://github.com/Lulzx/tinypdf/issues"},"homepage":"https://github.com/Lulzx/tinypdf#readme","devDependencies":{"@types/bun":"latest","typescript":"^5.9.3"},"gitHead":"353bb7ab958629f0cd0945ef1368e0cd93621c56","_id":"tinypdf@0.4.1","_nodeVersion":"26.5.1","_npmVersion":"11.7.0","dist":{"integrity":"sha512-I5/XUCvwuNR2tXx1BL1pDpgEs7xKVUPwH9Wq+Jsk19jEmmFBQTN7ULRSYsGqfETXeUZJUEoJKvDKFgOeJV6L4w==","shasum":"ca4bd4e0d8edbf916a29cf349dba1c3f0fbb8812","tarball":"https://registry.npmjs.org/tinypdf/-/tinypdf-0.4.1.tgz","fileCount":7,"unpackedSize":42652,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICIlAf5GBhSGEWip6gvF9kmSeGJvBPLJmf9FjwSxT1nmAiBWWZv0gl7Oz18x/9vM6A2VdxScwheFzpehH6qFlcLd0w=="}]},"_npmUser":{"name":"lulzx","email":"wiserishabh@gmail.com"},"directories":{},"maintainers":[{"name":"lulzx","email":"wiserishabh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tinypdf_0.4.1_1786628124196_0.7373262857119207"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-18T18:47:46.294Z","modified":"2026-08-13T13:35:24.497Z","0.1.0":"2025-12-18T18:47:46.550Z","0.2.0":"2025-12-22T15:01:16.369Z","0.3.0":"2025-12-24T15:21:02.881Z","0.3.1":"2026-02-15T20:58:25.566Z","0.4.1":"2026-08-13T13:35:24.331Z"},"bugs":{"url":"https://github.com/Lulzx/tinypdf/issues"},"author":{"name":"Lulzx"},"license":"MIT","homepage":"https://github.com/Lulzx/tinypdf#readme","keywords":["pdf","pdf-generator","pdf-creation","document","minimal","zero-dependencies"],"repository":{"type":"git","url":"git+https://github.com/Lulzx/tinypdf.git"},"description":"Minimal PDF creation library. <400 LOC, zero dependencies, makes real PDFs.","maintainers":[{"name":"lulzx","email":"wiserishabh@gmail.com"}],"readme":"# tinypdf\n\n[![npm](https://img.shields.io/npm/v/tinypdf)](https://www.npmjs.com/package/tinypdf)\n[![size](https://img.shields.io/bundlephobia/minzip/tinypdf)](https://bundlephobia.com/package/tinypdf)\n[![license](https://img.shields.io/npm/l/tinypdf)](LICENSE)\n\nMinimal PDF creation library. **<400 LOC, zero dependencies, makes real PDFs.**\n\n```bash\nnpm install tinypdf\n```\n\n| Executive report | Event ticket |\n|---|---|\n| [![Executive report](examples/executive-report-v2.png)](examples/executive-report.ts) | [![Event ticket](examples/event-ticket.png)](examples/event-ticket.ts) |\n| KPI dashboard and chart | Bold landscape admission ticket |\n| Certificate | Invoice |\n| [![Certificate](examples/certificate.png)](examples/certificate.ts) | [![Invoice](examples/invoice-v2.png)](examples/invoice.ts) |\n| Formal award certificate | Editorial studio invoice |\n\nRun any example with Bun, for example: `bun examples/executive-report.ts`.\n\n---\n\n## Why tinypdf?\n\n|  | tinypdf | jsPDF |\n|--|---------|-------|\n| **Size** | 3.3 KB | 229 KB |\n| **Dependencies** | 0 | 2 |\n\n**~70x smaller.** We removed TTF fonts, PNG/SVG, HTML-to-PDF, forms, encryption, and compression. What's left is the 95% use case: **put text and images on a page.**\n\n### Build with it\n\nInvoices, receipts, reports, shipping labels, tickets, certificates, contracts, data exports\n\n### Features\n\n| Feature | Description |\n|---------|-------------|\n| **Text** | Helvetica (WinAnsi), any size, hex colors, align left/center/right |\n| **Shapes** | Rectangles and lines |\n| **Images** | JPEG (photos, logos, signatures) |\n| **Links** | Clickable URLs with optional underline |\n| **Pages** | Multiple pages, custom sizes |\n| **Markdown** | Convert markdown to PDF with headers, lists, rules |\n\n### Not included\n\nUnicode/custom fonts, PNG/GIF/SVG, vector graphics, forms, encryption, compression, HTML-to-PDF\n\nNeed those? Use [jsPDF](https://github.com/parallax/jsPDF) or [pdf-lib](https://github.com/Hopding/pdf-lib).\n\n---\n\n## Quick start\n\n```typescript\nimport { pdf } from 'tinypdf'\nimport { writeFileSync } from 'fs'\n\nconst doc = pdf()\n\ndoc.page((ctx) => {\n  ctx.rect(50, 700, 200, 40, '#2563eb')           // blue rectangle\n  ctx.text('Hello PDF!', 60, 712, 24, { color: '#ffffff' })\n  ctx.line(50, 680, 250, 680, '#000000', 1)       // black line\n})\n\nwriteFileSync('output.pdf', doc.build())\n```\n\n### Add images\n\n```typescript\nimport { readFileSync } from 'fs'\n\ndoc.page((ctx) => {\n  const logo = new Uint8Array(readFileSync('logo.jpg'))\n  ctx.image(logo, 50, 700, 100, 50)\n})\n```\n\n### Add links\n\n```typescript\nimport { pdf, measureText } from 'tinypdf'\n\ndoc.page((ctx) => {\n  const text = 'Visit Example.com'\n  const y = 700\n  ctx.text(text, 50, y, 14, { color: '#0066cc' })\n  ctx.link('https://example.com', 50, y - 4, measureText(text, 14), 18, { underline: '#0066cc' })\n})\n```\n\n### Measure text width\n\n```typescript\nimport { measureText } from 'tinypdf'\n\nmeasureText('Hello', 12) // => 27.34 (points)\n```\n\n### Markdown to PDF\n\n```typescript\nimport { markdown } from 'tinypdf'\nimport { writeFileSync } from 'fs'\n\nconst pdf = markdown(`\n# Hello World\n\nA minimal PDF from markdown.\n\n## Features\n- Headers (h1, h2, h3)\n- Bullet lists\n- Numbered lists\n- Horizontal rules\n\n---\n\nAutomatic word wrapping and pagination included.\n`)\n\nwriteFileSync('output.pdf', pdf)\n```\n\n### Stream large PDFs\n\nUse `buildStream()` to emit a `ReadableStream<Uint8Array>` incrementally. Page content and image inputs are retained until the stream reaches them, but stream bodies are emitted directly and the final PDF is not assembled into one additional full-size buffer.\n\n```typescript\nimport { pdf } from 'tinypdf'\n\nconst doc = pdf()\nfor (let i = 0; i < 10_000; i++) {\n  doc.page((ctx) => ctx.text(`Page ${i + 1}`, 50, 750, 12))\n}\n\n// Write to disk (Bun)\nawait Bun.write('huge.pdf', doc.buildStream())\n\n// Or serve as an HTTP response\nreturn new Response(doc.buildStream(), {\n  headers: { 'Content-Type': 'application/pdf' },\n})\n```\n\n---\n\n## API\n\n```typescript\npdf()                                      // create document\ndoc.page(callback)                         // add page (612×792 default)\ndoc.page(width, height, callback)          // add page with custom size\ndoc.build()                                // returns Uint8Array\ndoc.buildStream()                          // returns ReadableStream<Uint8Array>\n\nctx.text(str, x, y, size, options?)        // options: { color, align, width }\nctx.rect(x, y, w, h, fill)                 // filled rectangle\nctx.line(x1, y1, x2, y2, stroke, width?)   // line\nctx.image(jpegBytes, x, y, w, h)           // JPEG image\nctx.link(url, x, y, w, h, options?)        // options: { underline }\n\nmeasureText(str, size)                     // text width in points\nmarkdown(str, options?)                    // options: { width, height, margin }\n```\n\n---\n\n## Full example\n\nSee the complete [invoice generator](examples/invoice.ts) for a production-style layout using only tinypdf's core text, rectangle, and line primitives.\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}