pdf-compiler

command module
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: AGPL-3.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Logo

📄 PDF Compiler

Go Report Card Build Latest Release client

pdf-compiler is a simple LaTeX and HTML → PDF compiler over HTTP, written in Go. It supports compiling LaTeX documents using pdflatex and HTML documents using headless Chrome.

Prerequisites

  • Go 1.25+
  • swag — for generating Swagger docs
  • docker — for running the full stack

Build

The default make target vendors dependencies, generates Swagger docs, and builds the binary:

make

Run it:

./pdf-compiler

Other useful targets:

Target Description
make swag Regenerate Swagger docs from source annotations
make templates_sync Clone the private LaTeX templates repo into ./templates
make clean Remove the built binary and templates directory
make update Update all Go dependencies to their latest versions

Running with Docker

The canonical way to run the full stack (pdf-compiler + texlive sidecar + templates):

docker compose up

The service is then reachable at http://localhost:8080.

Configuration

All options are read from environment variables (or a .env file in the working directory):

Variable Default Description
BASE_PATH /api/v1 HTTP path prefix for all API routes
PORT :8080 Listen address (e.g. :80)
TEMPLATE_DIR templates Directory added to TEXINPUTS for LaTeX templates
LOG_LEVEL info Zerolog level (trace, debug, info, warn, error)
PATH_TO_CHROME_BIN google-chrome-stable Path or name of the Chrome binary used for HTML→PDF

API

POST /compile

Compiles a LaTeX document to PDF.

{ "tex": "\\documentclass{article}\n\\begin{document}\nHello!\n\\end{document}" }

Returns application/pdf on success, or a JSON error on failure.

POST /compile-html

Compiles an HTML document to PDF using headless Chrome.

{ "html": "<html><body><h1>Hello!</h1></body></html>" }

Returns application/pdf on success.

GET /health

Returns 200 OK.

Documentation

Interactive Swagger UI: http://localhost:8080/swagger/index.html

Raw spec: http://localhost:8080/swagger/doc.json — also committed to the docs/ directory.

TypeScript Client

A generated TypeScript client is published to npm. See the client README for usage.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL