Announcing crystal-pdf, crystal-asciidoctor, and crystal-asciidoctor-pdf

Hi everyone,

I’m happy to announce the release of three interconnected Crystal shards for PDF generation and AsciiDoc processing:

crystal-pdf (v0.1.0)

A pure Crystal library for low-level PDF generation. Forked from watzon/pdf.cr with major additions: formatted text layout, bounding boxes, multi-column layout, table rendering, SVG rendering, annotations, bookmarks/outline, and TrueType font embedding.

  • 646 tests, 0 failures
  • GitHub

crystal-asciidoctor (v2.0.26)

A Crystal port of the Asciidoctor Ruby gem (v2.0.26). Full pipeline: parse → substitute → convert, with HTML5, DocBook 5, and ManPage converters.

  • 2221 tests, 0 failures
  • GitHub

crystal-asciidoctor-pdf (v2.3.24)

An AsciiDoc-to-PDF converter, the Crystal equivalent of asciidoctor-pdf (v2.3.24). Supports sections, lists, tables, code highlighting (12 languages), admonitions, TOC, bookmarks, clickable links, TTF fonts, and YAML themes.

  • 43 tests, 0 failures
  • Includes a CLI: crystal-asciidoctor-pdf document.adoc
  • GitHub

Installation

# shard.yml — pick the shards you need
dependencies:
  crystal-pdf:
    github: aloli-crystal/crystal-pdf
    version: "~> 0.1"
  crystal-asciidoctor:
    github: aloli-crystal/crystal-asciidoctor
    version: "~> 2.0"
  crystal-asciidoctor-pdf:
    github: aloli-crystal/crystal-asciidoctor-pdf
    version: "~> 2.3"

Context

There is currently no mature pure-Crystal PDF library. crystal-pdf, with its text layout engine, table support, and SVG rendering, aims to fill that gap. The existing thread on Let’s work on pdf.cr was an inspiration.

Feedback, issues, and contributions are very welcome !

Nice! Wonder if I can do a markdown renderer using this now that markd’s master has tables

The porting of Ruby gems related to Markdown is underway.

I will soon offer a “crystal-markdown” shard that will allow conversion from Markdown to PDF/EPUB/HTML/reveal.js.