talira

@pdfme/pdf-lib

This version is forked from Hopding/pdf-lib, with several bug fixes and additional features

open sourceMITself-hostablefree

Forked from pdf-lib in 2023. pdfme forked pdf-lib to carry the bug fixes and features its PDF generator and designer need

@pdfme/pdf-lib is the fork of pdf-lib that pdfme, an open source PDF generator and template designer, keeps in its monorepo and publishes with each pdfme release. It keeps pdf-lib's API, including the AcroForm classes for filling and flattening form fields, and adds the fixes pdfme needed: rounded-corner rectangles, full SVG drawing taken from @cantoo/pdf-lib, and support for fontkit v2, which fixed garbled subsets of some Japanese and Chinese fonts. It's MIT licensed.

Problems it solves

  • draw rectangles with rounded corners on a PDF page from JavaScript
  • Japanese and Chinese text comes out garbled when I subset the font I embed in a PDF
  • use fontkit v2 instead of @pdf-lib/fontkit to embed fonts in a PDF
  • a pdf-lib build that still gets releases, without changing my code's imports beyond the package name

Features

  • pdf-lib's API: create and modify PDFs, pages, fonts, images
  • AcroForm classes: PDFForm, PDFTextField, PDFCheckBox, PDFDropdown, PDFRadioGroup, flatten()
  • radius option on drawRectangle for rounded corners
  • drawSvg from @cantoo/pdf-lib
  • works with foliojs/fontkit v2
  • released with pdfme's versions

What this fork adds

  • Adds a radius option to drawRectangle for rounded corners Not offered upstream
  • Brings in @cantoo/pdf-lib's drawSvg so whole SVG images can be drawn on a page Not offered upstream
  • Works with foliojs/fontkit v2, fixing garbled subsets of some Japanese and Chinese fonts Not offered upstream

Alternatives

The same job

These do what @pdfme/pdf-lib does.

  1. @cantoo/pdf-lib An actively maintained fork of pdf-lib: create and modify PDF documents in any JavaScript environment
  2. pdf-lib Create and modify PDF documents in any JavaScript environment.

Compare @pdfme/pdf-lib with the top 3