Installation
Hosted API
The API client uses only the Go standard library. Create templates in the dashboard, then render them with data:Client options
Methods
| Method | Description | Returns |
|---|---|---|
Render(slug, data) | Synchronous render | ([]byte, error) |
RenderWithOptions(slug, data, opts) | Render with options | ([]byte, error) |
RenderS3(slug, data, s3Opts) | Render and upload to S3 | (*S3Result, error) |
RenderAsync(slug, data, asyncOpts) | Start async render job | (*AsyncResult, error) |
GetJob(jobID) | Poll async job status | (*JobResult, error) |
Merge(pdfs) | Merge multiple PDFs | ([]byte, error) |
Extract(pdfBytes) | Extract embedded data | (map[string]any, error) |
Error handling
Native templates
Build documents in Go code using a component DSL that mirrors the JSX API. Renders locally via the WASM engine — no network calls.Components
| Constructor | Description | Chainable methods |
|---|---|---|
Document(children...) | Root container | .Title(), .Author(), .Subject(), .Lang(), .DefaultStyle(), .Fonts(), .Tagged() |
Page(children...) | Page container | .Size(), .Margin() |
View(children...) | Flex/grid container | .Style(), .Wrap(), .Bookmark(), .Href() |
Text(content, style?) | Text element | .Style(), .Href(), .Children() |
Image(src) | Image element | .Width(), .Height(), .Style(), .Href(), .Alt() |
Table(children...) | Table with auto-repeating headers | .Columns(), .Style() |
Row(children...) | Table row | .Header(), .Style() |
Cell(children...) | Table cell | .ColSpan(), .RowSpan(), .Style() |
QRCode(data) | Vector QR code | .Size(), .Color(), .Style() |
Barcode(data) | 1D barcode | .Format(), .Width(), .Height(), .Color(), .Style() |
BarChart(data) | Bar chart | .Width(), .Height(), .Color(), .Title(), .Style() |
LineChart(series, labels) | Line chart | .Width(), .Height(), .ShowPoints(), .Title(), .Style() |
PieChart(data) | Pie/donut chart | .Width(), .Height(), .Donut(), .Title(), .Style() |
PageBreak() | Force page break | — |
Watermark(text) | Rotated watermark | .FontSize(), .Color(), .Angle(), .Style() |
Building the WASM binary
Local rendering requires the Forme WASM binary:Hosted vs native
| Hosted API | Native templates | |
|---|---|---|
| Dependencies | Zero (stdlib only) | wazero (~10MB WASM) |
| Templates | Pre-uploaded via dashboard | Built in Go code |
| Network | Requires API call | Fully offline |
| Use case | Dynamic data + stored templates | Full control, CI/CD, testing |