FormaTeX

\begin{pdf-api}

PDF Generation API

A PDF generation API lets you compile documents programmatically with a single HTTP request — no local tooling required. FormaTeX provides a LaTeX-based REST API that produces publication-quality PDFs from any language, framework, or automation tool.

\section{Definition}

What is a PDF generation API?

A PDF generation API is a REST service that accepts document source — HTML, LaTeX, Markdown, or a template — and returns a compiled PDF file as a binary response. Instead of installing PDF tooling on every machine that needs to produce documents, you make an HTTP request from any language or platform and receive a ready-to-use PDF in the response body.

Any language, any platform

A single HTTP POST works from Python, Node.js, Go, Ruby, PHP, or any no-code tool with an HTTP action.

No local installation

No TeX Live, wkhtmltopdf, headless Chrome, or Puppeteer to install, update, or maintain on your servers.

Predictable output

A managed API produces identical output across environments. No more 'it renders differently in CI' PDF bugs.

\section{Comparison}

LaTeX-based vs HTML-based PDF APIs

FeatureLaTeX API (FormaTeX)HTML-to-PDF API
Typography qualityProfessional — Knuth–Plass, microtypographyBrowser-level rendering
MathematicsNative amsmath, full equation supportMathJax/KaTeX workaround
Page layout controlPrecise — margins, columns, headers, footersCSS approximation, print quirks
Long documentsTable of contents, cross-refs, bibliographyComplex to manage reliably
FontsFull OTF/TTF support with xelatex/lualatexLimited to system/web fonts
Source formatLaTeX (.tex)HTML + CSS
Setup complexityHigher initial curve, huge payoffFamiliar if you know HTML/CSS
Best forReports, papers, invoices, certificatesSimple receipts, web page snapshots

\section{FormaTeX}

The FormaTeX approach

FormaTeX runs a full TeX Live distribution in an isolated server-side environment. Every compile request gets a fresh sandbox — no cross-contamination between jobs, no stale auxiliary files, no security risk from user-supplied LaTeX. The compiled PDF is returned as raw bytes in the HTTP response and then deleted from our servers.

Synchronous compilation

POST to /v1/compile/sync and receive the PDF bytes directly in the response. Ideal for on-demand generation where you need the file immediately.

Three LaTeX engines

Choose pdflatex (fast, widest compatibility), xelatex (Unicode, system fonts), or lualatex (Lua scripting, advanced typography).

Ephemeral compilation

Your LaTeX source and the compiled PDF are deleted from our servers immediately after the response is sent. Nothing is stored.

Simple authentication

Pass your API key in the Authorization: Bearer header. Generate as many keys as you need from the dashboard and revoke them individually.

\section{Quick Start}

Compile your first PDF in 30 seconds

Run this curl command after replacing YOUR_API_KEY with your FormaTeX key. The --output hello.pdf flag saves the raw PDF bytes to a file in your current directory.

quick-start.sh
curl -X POST https://api.formatex.io/v1/compile/sync \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "\\documentclass{article}\n\\begin{document}\n\\title{Hello, FormaTeX!}\n\\author{Your Name}\n\\date{\\today}\n\\maketitle\n\nThis PDF was generated via the FormaTeX API.\n\n\\end{document}",
    "engine": "pdflatex"
  }' \
  --output hello.pdf

\section{Use Cases}

What teams build with a PDF generation API

Automated reports

Generate monthly analytics reports, financial summaries, or operational dashboards as PDFs on a schedule — populated from live data.

Invoices and receipts

Compile professional invoices from billing system data. LaTeX handles multi-column line items, totals, and tax sections precisely.

Certificates of completion

Generate personalised completion certificates for e-learning platforms. Inject names, course titles, and dates dynamically.

Academic papers and theses

Compile research papers, conference submissions, and theses with full LaTeX formatting — bibliographies, equations, figures, and all.

\section{FAQ}

Frequently asked questions

Do I need to know LaTeX to use FormaTeX?

Basic LaTeX is straightforward for common documents. The FormaTeX playground lets you experiment interactively. For AI-powered workflows, you can use GPT-4 or Claude to generate the LaTeX source — you only need to write the prompt.

What LaTeX engines does FormaTeX support?

FormaTeX supports pdflatex (fastest, widest package compatibility), xelatex (Unicode text, OpenType fonts), and lualatex (Lua scripting, advanced typography). Specify your engine in the request body.

How long does compilation take?

Simple documents compile in under one second. Complex documents with many packages, TikZ figures, or bibliographies typically compile in two to five seconds.

Is my LaTeX source stored after compilation?

No. Your LaTeX source and the compiled PDF are deleted from our servers immediately after the HTTP response is sent. Nothing is persisted.

Can I use any CTAN package?

Yes. FormaTeX runs a full TeX Live installation. Any package available on CTAN is available in your compilation environment without any configuration.

\end{pdf-api}

Start generating PDFs via API

Sign up for a free FormaTeX account, grab your API key, and compile your first PDF with one curl command — no credit card required.

One quick thing

We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.

Cookie policy