Native Elixir PDF Utilities

License Hex.pm HexDocs Elixir ~> 1.19

Native Elixir PDF Utilities

Native Elixir PDF Utilities renders HTML/CSS to PDF, reads and updates metadata and bookmarks, extracts embedded text, and merges, transforms, splits, and stamps PDFs, fills forms, and embeds attachments. It runs inside Elixir applications without external PDF command-line tools.

Package and docs

What it does

  1. Tokenizer - turns PDF byte streams into structured Elixir tokens.

  2. PDF information - reads page geometry and document metadata, detects encryption, and updates common metadata fields.

  3. Merger - combines multiple PDF binaries into a fresh PDF with rewritten object references.

  4. Page transforms and splitting - rebuild PDFs after selecting, reordering, deleting, rotating, or splitting pages.

  5. Outlines and bookmarks - read or replace bookmarks, detect headings in existing PDFs, and generate bookmarks from HTML headings. Merging, transforms, and splitting preserve supported outlines.

  6. Stamping and page numbers - adds text stamps, translucent watermarks, page numbers, and PDF artwork overlays to existing PDFs through incremental updates.

  7. Reader and text extraction - strictly resolve embedded Unicode text from classic and modern PDFs.

  8. HTML to PDF - renders a strict, document-oriented HTML/CSS subset to native PDF bytes, with examples for common workflows. It supports configured fonts and cross-platform discovery of installed system fonts. Rendering does not require Chromium, wkhtmltopdf, Node, SaaS calls, or a Rust toolchain. Local asset loading works on Windows, macOS, and Linux.

  9. PDF forms - generates named AcroForm fields from HTML by default, inspects and fills existing fields, and flattens selected fields.

  10. Attachments - embeds caller-approved file bytes with MIME detection and lists embedded metadata.

See the documentation for feature guides, configurable resource limits, and quick reference.

Installation

def deps do
  [
    {:native_elixir_pdf_utilities, "~> 0.18.0"}
  ]
end

Development

Run the complete supported-version quality matrix before contributing:

./scripts/quality-matrix

The matrix compiles and tests the supported Elixir versions, enforces formatting and 100% coverage, runs Dialyzer, and compares HTML-to-PDF fixtures with Chromium. See the contribution guide for prerequisites, quicker installed-version checks, and result interpretation.

License

The library source is MIT licensed. Bundled DejaVu font files use the Bitstream Vera license; WHATWG character-reference data and Adobe glyph-name data retain their respective BSD 3-Clause notices. See the complete license texts.