\begin{pdf-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}
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}
| Feature | LaTeX API (FormaTeX) | HTML-to-PDF API |
|---|---|---|
| Typography quality | Professional — Knuth–Plass, microtypography | Browser-level rendering |
| Mathematics | Native amsmath, full equation support | MathJax/KaTeX workaround |
| Page layout control | Precise — margins, columns, headers, footers | CSS approximation, print quirks |
| Long documents | Table of contents, cross-refs, bibliography | Complex to manage reliably |
| Fonts | Full OTF/TTF support with xelatex/lualatex | Limited to system/web fonts |
| Source format | LaTeX (.tex) | HTML + CSS |
| Setup complexity | Higher initial curve, huge payoff | Familiar if you know HTML/CSS |
| Best for | Reports, papers, invoices, certificates | Simple receipts, web page snapshots |
\section{FormaTeX}
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}
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.
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}
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}
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}
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.