Appearance
Changelog
All notable changes to @criston/zeropdf are documented here. This project follows Semantic Versioning.
[1.3.0] - 2026-06-02
Added
- Shape helpers on
PdfPage:rect(),line(),circle(),ellipse()with a simplifiedShapeStyle(inferred fill/stroke paint mode). - Text measurement:
PdfDocument.measureText(),measureTextBlock(), andmeasureRichText()return width/height/line-count without drawing. PdfPage.image()auto-detects the raster format (PNG, JPEG, GIF, BMP, TIFF, WebP, JPEG 2000) from the data.addPage({ origin: "top-left" })flips the y-axis so coordinates grow downward from the top edge — applied across the page drawing, annotation, and form-field methods.underlineandstrikeoptions on text and inline runs, drawn as decorative lines.- Named colors: text/shape
coloroptions accept names like"red", plus acolor()helper that resolves named and#hexcolors. - Shape and image helpers on
PdfStructureContainer(rect,line,circle,ellipse,image,path) andellipse/lineonPdfFlow. registerFontFamily()accepts raw font bytes per face (embedded automatically) in addition to handles and built-in names (FontFamilyInput).- Document-wide shape defaults via
createDocument({ shapeDefaults }), merged beneath per-call styles by the page shape helpers. - Layout-feedback methods
PdfPage.placeText()andplaceTextBlock()that draw and return{ width, height, (lineCount,) endY }for manual stacking. - "Choosing an API" guide page mapping common goals to the right API.
Changed
- The
fontoption now reports a clear "did you mean" error (INVALID_FONT) for an unknown string font instead of silently falling back, suggesting the closest standard-14 name. Unknown page-size names throwINVALID_PAGE_SIZEwith the same suggestion treatment. PdfStructureContainerbuilder methods (text,textBlock,list,table, image,link) now returnthisfor chaining, consistent withPdfPageandPdfFlow.
[1.2.1] - 2026-06-02
Fixed
- The
fonttext option now accepts a font-family name registered withregisterFontFamily()(and anystring-typed value), instead of rejecting it at compile time.PdfFontwidened toFontName | PdfEmbeddedFont | (string & {}), preserving built-in name autocomplete.
[1.2.0] - 2026-06-02
Added
- Inline rich text:
PdfPage.richText()andPdfFlow.richParagraph()lay out an array ofInlineTextRunsegments that flow on the same line and wrap together, each with its own font, weight, size, color, and optionallink. richParagraphtemplate block (TemplateRichParagraphBlock) for inline rich text inrenderTemplate().- Inline rich text supports
align: "justify", line-leveldirection("ltr" | "rtl" | "auto"), andwritingMode: "vertical"(single-column stacking); flow and template rich paragraphs wrap and split across columns and pages. - Vertical alignment:
verticalAlign("top" | "middle" | "bottom") on table cells (TableOptionsdefault and per-TableCellDefinition). - Vertical alignment within a fixed-height box via
height+verticalAlignonTextBlockOptionsandRichTextOptions. - New exported types:
InlineTextRun,RichTextOptions,FlowRichTextOptions,TemplateRichParagraphBlock,VerticalAlign.
[1.1.0] - 2026-06-02
Added
boldanditalictext options that resolve to the matching font face for the standard-14 base families (Helvetica, Times, Courier).PdfDocument.registerFontFamily()to group font faces (built-in or embedded) under a name, selectable with thebold/italicflags.- Document-wide text defaults via
createDocument({ defaults })(font,bold,italic,fontSize,color,kerning,direction). - Unit helpers
mm(),cm(),inch(), andpt()for authoring layouts in physical units. PdfDocument.save(path)convenience alias forwriteToFile().
Changed
PdfPagebuilder methods (text, images, annotations, form fields, graphics state, transforms) now returnthisfor fluent chaining.bold/italic, registered font families, and document defaults resolve uniformly acrosspage.text()/textBlock(), thePdfFlowcursor API,renderTemplate()blocks, and structure containers.
[1.0.0] - 2026-05-11
Added
- Zero-dependency PDF 1.4+ generation engine in TypeScript.
- PDF 1.5 object streams and 2.0 encryption support.
- Text rendering with 14 standard fonts plus embedded TrueType (Unicode, kerning, ligatures, RTL/Arabic).
- Image support: JPEG, PNG (transparency/alpha).
- Tagged PDF for accessibility: PDF/UA-1, structure trees, MCID-based marked content.
- Flow-based coordinate-free layout engine.
- Template-based report/document rendering with headers, footers, page numbers, and auto-outline.
- Forms (AcroForm): text, checkbox, radio, choice, push button, signature.
- Annotations: URI links, highlights, notes, free-text.
- Encryption: rc4-40, rc4-128, AES-128, AES-256.
- PDF parsing and incremental editing: metadata, pages, forms, overlays.
- Page transfer utilities: extract, split, merge, append.
- Streaming output via ByteSink abstraction.
- XMP metadata support.
- Linearized (Fast Web View) output for single-page documents.
- PDF version auto-detection and conformance validation.