[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74942":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":42,"discoverSource":43},74942,"core","LibPDF-js\u002Fcore","LibPDF-js","A modern PDF library for TypeScript. Parse, modify, and generate PDFs with a clean, intuitive API.","https:\u002F\u002Flibpdf.dev",null,"TypeScript",1727,58,8,18,0,2,10,24,6,64.71,"MIT License",false,"main",[26,27,28,29,30,31,32,33,34,35,36,37,38],"digital-signature","document","esign","generator","pades","parser","pdf","pdf-document","pdf-generator","pdf-parsing","pkcs7","signing","typescript","2026-06-12 04:01:16","# LibPDF\n\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@libpdf\u002Fcore)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@libpdf\u002Fcore)\n[![npm downloads](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002F@libpdf\u002Fcore)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@libpdf\u002Fcore)\n[![CI](https:\u002F\u002Fgithub.com\u002FLibPDF-js\u002Fcore\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FLibPDF-js\u002Fcore\u002Factions\u002Fworkflows\u002Fci.yml)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Flibpdf-js\u002Fcore?style=flat)](https:\u002F\u002Fgithub.com\u002FLibPDF-js\u002Fcore)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)](LICENSE)\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.0-blue?logo=typescript&logoColor=white)](https:\u002F\u002Fwww.typescriptlang.org\u002F)\n\nA modern PDF library for TypeScript. Parse, modify, and generate PDFs with a clean, intuitive API.\n\n> **Beta Software**: LibPDF is under active development and APIs may change between minor versions, but we use it in production at [Documenso](https:\u002F\u002Fdocumenso.com) and consider it ready for real-world use.\n\n## Why LibPDF?\n\nLibPDF was born from frustration. At [Documenso](https:\u002F\u002Fdocumenso.com), we found ourselves wrestling with the JavaScript PDF ecosystem:\n\n- **PDF.js** is excellent for rendering and even has annotation editing — but it requires a browser\n- **pdf-lib** has a great API, but chokes on slightly malformed documents\n- **pdfkit** only generates, no parsing at all\n\nWe kept adding workarounds. A patch here for a malformed xref table. A hack there for an encrypted document. Eventually, we decided to build what we actually needed:\n\n- **Lenient like PDFBox and PDF.js**: opens documents other libraries reject\n- **Intuitive like pdf-lib**: clean, TypeScript-first API\n- **Complete**: encryption, digital signatures, incremental saves, form filling\n\n## Features\n\n| Feature            | Status | Notes                                      |\n| ------------------ | ------ | ------------------------------------------ |\n| Parse any PDF      | Yes    | Graceful fallback for malformed documents  |\n| Create PDFs        | Yes    | From scratch or modify existing            |\n| Encryption         | Yes    | RC4, AES-128, AES-256 (R2-R6)              |\n| Digital Signatures | Yes    | PAdES B-B, B-T, B-LT, B-LTA                |\n| Form Filling       | Yes    | Text, checkbox, radio, dropdown, signature |\n| Form Flattening    | Yes    | Bake fields into page content              |\n| Merge & Split      | Yes    | Combine or extract pages                   |\n| Attachments        | Yes    | Embed and extract files                    |\n| Text Extraction    | Yes    | With position information                  |\n| Font Embedding     | Yes    | TTF\u002FOpenType with subsetting               |\n| Images             | Yes    | JPEG, PNG (with alpha)                     |\n| Incremental Saves  | Yes    | Append changes, preserve signatures        |\n\n## Installation\n\n```bash\nnpm install @libpdf\u002Fcore\n# or\nbun add @libpdf\u002Fcore\n```\n\n## Quick Start\n\n### Parse an existing PDF\n\n```typescript\nimport { PDF } from \"@libpdf\u002Fcore\";\n\nconst pdf = await PDF.load(bytes);\nconst pages = pdf.getPages();\n\nconsole.log(`${pages.length} pages`);\n```\n\n### Open an encrypted PDF\n\n```typescript\nconst pdf = await PDF.load(bytes, { credentials: \"password\" });\n```\n\n### Fill a form\n\n```typescript\nconst pdf = await PDF.load(bytes);\nconst form = pdf.getForm();\n\nform.fill({\n  name: \"Jane Doe\",\n  email: \"jane@example.com\",\n  agreed: true,\n});\n\nconst filled = await pdf.save();\n```\n\n### Sign a document\n\n```typescript\nimport { PDF, P12Signer } from \"@libpdf\u002Fcore\";\n\nconst pdf = await PDF.load(bytes);\nconst signer = await P12Signer.create(p12Bytes, \"password\");\n\nconst signed = await pdf.sign({\n  signer,\n  reason: \"I approve this document\",\n});\n```\n\n### Merge PDFs\n\n```typescript\nconst merged = await PDF.merge([pdf1Bytes, pdf2Bytes, pdf3Bytes]);\n```\n\n### Draw on a page\n\n```typescript\nimport { PDF, rgb } from \"@libpdf\u002Fcore\";\n\nconst pdf = PDF.create();\nconst page = pdf.addPage({ size: \"letter\" });\n\npage.drawText(\"Hello, World!\", {\n  x: 50,\n  y: 700,\n  fontSize: 24,\n  color: rgb(0, 0, 0),\n});\n\npage.drawRectangle({\n  x: 50,\n  y: 600,\n  width: 200,\n  height: 100,\n  color: rgb(0.9, 0.9, 0.9),\n  borderColor: rgb(0, 0, 0),\n  borderWidth: 1,\n});\n\nconst output = await pdf.save();\n```\n\n## Runtime Support\n\nLibPDF runs everywhere:\n\n- **Node.js** 20+\n- **Bun**\n- **Browsers** (modern, with Web Crypto)\n\n## Known Limitations\n\nSome features are not yet implemented:\n\n| Feature                     | Status           | Notes                                  |\n| --------------------------- | ---------------- | -------------------------------------- |\n| Signature verification      | Not implemented  | Signing works; verification is planned |\n| TrueType Collections (.ttc) | Not supported    | Extract individual fonts first         |\n| JBIG2 image decoding        | Passthrough only | Images preserved but not decoded       |\n| JPEG2000 (JPX) decoding     | Passthrough only | Images preserved but not decoded       |\n| Certificate encryption      | Not supported    | Password encryption works              |\n| JavaScript actions          | Ignored          | Form calculations not executed         |\n\nThese limitations are documented to set expectations. Most don't affect typical use cases like form filling, signing, or document manipulation.\n\n## Philosophy\n\n### Be lenient\n\nReal-world PDFs are messy. Export a document through three different tools and you'll get three slightly different interpretations of the spec. LibPDF prioritizes _opening your document_ over strict compliance. When standard parsing fails, we fall back to brute-force recovery, scanning the entire file to rebuild the structure.\n\n### Two API layers\n\n- **High-level**: `PDF`, `PDFPage`, `PDFForm` for common tasks\n- **Low-level**: `PdfDict`, `PdfArray`, `PdfStream` for full control\n\n## Documentation\n\nFull documentation at [libpdf.dev](https:\u002F\u002Flibpdf.dev)\n\n## Sponsors\n\nLibPDF is developed by [Documenso](https:\u002F\u002Fdocumenso.com), the open-source DocuSign alternative.\n\n\u003Ca href=\"https:\u002F\u002Fdocumenso.com\">\n  \u003Cimg src=\"apps\u002Fdocs\u002Fpublic\u002Fsponsors\u002Fdocumenso.png\" alt=\"Documenso\" height=\"24\">\n\u003C\u002Fa>\n\n## Contributing\n\nWe welcome contributions! See our [contributing guide](CONTRIBUTING.md) for details.\n\n```bash\n# Clone the repo\ngit clone https:\u002F\u002Fgithub.com\u002Flibpdf\u002Fcore.git\ncd libpdf\n\n# Install dependencies\nbun install\n\n# Run tests\nbun run test\n\n# Type check\nbun run typecheck\n```\n\n## License\n\n[MIT](LICENSE)\n\nThe `src\u002Ffontbox\u002F` directory is licensed under [Apache-2.0](src\u002Ffontbox\u002FLICENSE) as it is derived from [Apache PDFBox](https:\u002F\u002Fpdfbox.apache.org\u002F).\n","LibPDF-js\u002Fcore 是一个面向 TypeScript 的现代 PDF 库，用于解析、修改和生成 PDF 文档。它提供了一个清晰直观的 API，支持多种高级功能如加密、数字签名（包括 PAdES 标准）、表单填充与扁平化处理、合并与拆分文档等。该库对格式不规范的 PDF 文件有良好的兼容性，并且支持增量保存以保留已有的签名。适用于需要在 Node.js 或浏览器环境中处理 PDF 文件的各种应用场景，特别是对于那些要求高稳定性和安全性的电子文档管理系统。","2026-06-11 03:51:31","high_star"]