Skip to content

Releases: calcifux/pdf-toolkit

Release list

pdf-toolkit 0.1.0

Choose a tag to compare

@calcifux calcifux released this 16 Jun 11:51

HTML-to-PDF for Java — write a typed PdfDocument (template + vars, page size/margins, headers, footers, page numbers) and get bytes. Agnostic of both the templating engine and the PDF engine. Based on pdf-utils, rebuilt as a navaja with everything learned in mailable-toolkit.

byte[] pdf = Pdf.generate(new InvoicePdf(invoice));

Modules

  • pdf-toolkit-core — pure Java (slf4j only): PdfDocument/PdfSpec, page layout → @page CSS, the TemplateRenderer / PdfEngine / PdfPostProcessor SPIs, and PdfGenerator. No Spring, no PDF library.
  • pdf-toolkit-pebble (default) / -thymeleaf / -freemarkerTemplateRenderer adapters (inheritance + inline + HTML-escape).
  • pdf-toolkit-openhtmltopdf — the default PdfEngine (OpenHTMLtoPDF / PDFBox), the engine pdf-utils used.
  • pdf-toolkit-spring — Spring Boot starter: pdf-toolkit.* config, engine auto-selection, the static Pdf facade.

Design

  • Templating is optional and pluggable — a PdfSpec carrying final html skips it entirely (no engine on the classpath needed); inlineHtml renders a DB-stored template string; template resolves a named template with inheritance.
  • The HTML-to-PDF engine is pluggable behind PdfEngine; the core imports no PDF library.
  • Generation, not document processing — encrypt / watermark / merge / sign are PdfPostProcessor beans contributed by the app (same boundary as mailable-toolkit). 21 tests green; decisions in docs/adr.

Install (JitPack)

<dependency>
  <groupId>com.github.calcifux.pdf-toolkit</groupId>
  <artifactId>pdf-toolkit-spring</artifactId>
  <version>v0.1.0</version>
</dependency>
<dependency>
  <groupId>com.github.calcifux.pdf-toolkit</groupId>
  <artifactId>pdf-toolkit-openhtmltopdf</artifactId>
  <version>v0.1.0</version>
</dependency>