Getting started

Introduction

What comark-pdf is, how it fits with Comark and jasy, and when to use it for print-ready PDF output.

comark-pdf is the PDF renderer for Comark. It converts Comark Markdown to print-ready PDF bytes through jasy — no headless browser required.

How it works

Three layers, one job each:

LayerJob
ComarkParse markdown to an AST.
comark-pdfRead that AST. Choose policy. Call jasy primitives.
jasyDraw and lay out PDF primitives. It does not parse Markdown, Mermaid, KaTeX, or Shiki.

Merge order for page config (last write wins): frontmatter.pdf → options.pdf.

What you get

  • One-shot or reusable renderers — renderPdf() or createPdfRenderer() with a parser initialized once
  • Node helpers — renderPdfToBuffer and renderPdfToFile from comark-pdf/node
  • Browser preview — mount bytes with comark-pdf/preview
  • Host options — page size, margins, chrome, fonts, visuals, plugins, components, and binding data
  • Feature matrix — see Syntax matrix for what Comark syntax maps to PDF
comark is a peer dependency. Install it in your app alongside comark-pdf.
Copyright © 2026