PDF CLI

Convert documents to PDF from the command line — without starting an HTTP server.

The ANNÁVE PDF Engine ships a CLI binary (annave) that runs the full conversion pipeline locally. No server, no HTTP — useful for scripts, CI pipelines, and one-off conversions where starting an HTTP server is unnecessary overhead.

Build the CLI

Build the annave binary from the repository root:

bash
go build -o annave ./cmd/cli

Move the binary to a directory on your $PATH to use it from anywhere:

bash
mv annave /usr/local/bin/annave

Commands

annave pdf convert

Convert a document file to PDF. The --format flag is optional — the engine infers the format from the file extension by default.

bash
annave pdf convert [file] [flags]
FlagShortDefaultDescription
--output-ostdoutOutput PDF path. Omit to write PDF bytes to stdout.
--format-fautoInput format: md, html, docx, csv, json, yaml, xml, rst, ipynb, png, jpg, gif, webp, txt
--stdinfalseRead input from stdin instead of a file argument
--style(none)Per-document style override as JSON, e.g. '{"paragraph":{"fontSize":14}}'

Examples

Common conversion patterns. All produce a valid PDF to the specified output path, or to stdout if --output is omitted.

bash
# Convert a Markdown file
annave pdf convert README.md -o output.pdf

# Convert a Word document
annave pdf convert report.docx -o report.pdf

# Convert CSV to a table PDF
annave pdf convert data.csv -o table.pdf

# Read from stdin (pipe-friendly)
cat spec.md | annave pdf convert --stdin --format md > spec.pdf

# Override font size
annave pdf convert README.md -o big.pdf --style '{"paragraph":{"fontSize":14}}'

annave pdf serve

Start the HTTP server (same as running the server binary directly).

bash
annave pdf serve [--port 5741]

annave version

Print the installed engine version and exit.

bash
annave version
# ANNÁVE PDF Engine v1.0.0

Exit codes

CodeMeaning
0Conversion succeeded
1Error — message printed to stderr with the ENGINE_ERR_* code

Error output goes to stderr; PDF bytes go to stdout. This makes the CLI safe to use in pipelines — you can redirect stdout to a file without mixing in error messages.

CI / scripting example

Generate a PDF artifact as part of a CI pipeline. The script exits with code 1 if conversion fails, which causes the CI step to fail.

bash
#!/bin/bash
# Generate a PDF report in CI and upload as an artifact
annave pdf convert report.md -o dist/report.pdf \
  && echo "PDF generated: dist/report.pdf" \
  || exit 1