Forma PDF
Generate a PDF from JSON in the browser
By WVSTECH · Reviewed November 23, 2026 · Examples target SDK 0.4.0
Forma PDF generates a PDF from two separate JSON objects: a layout describing pages and fields, and values supplying document content. You can generate a file without displaying the visual editor. PDF generation runs in the browser and does not require an AI call.
Keep layout and values separate
A text field with the binding client.name reads a nested object. A table bound to items reads an array of rows. The SDK does not query your database: your application retrieves authorized records and supplies them.
import { generatePDF, validateDocumentData } from './sdk/forma-pdf.js'
const { layout } = await fetch('/docs/api/example.json').then(r => r.json())
const values = {
client: { name: 'Northstar Co.' },
items: [{ description: 'Design services', price: '$800.00' }],
total: '$800.00'
}
const validation = validateDocumentData(layout, values)
if (!validation.valid) throw new Error(JSON.stringify(validation.errors))
const pdf = await generatePDF(layout, values)
What does generatePDF return?
It returns a Promise resolving to an application/pdf Blob. Use downloadPDF for a user-triggered download, or upload the Blob through your own authenticated application. The JSON example endpoint above is public sample data; the SDK import refers to the files delivered with your purchase.
Start with the complete layout and values payload and consult the function contracts for supported fields and error behavior.
Continue building
- Add PDF templates to a Bolt or Lovable project
- Embed a visual PDF template editor in JavaScript
- Integrate a PDF editor with React and Next.js
- Save PDF templates as JSON in your database
- Create editable PDF templates in Bubble workflows
- Automatic PDF page breaks for text and tables
- Build a quotation PDF generator for your application
- Create a restaurant menu PDF from structured data
- Generate internal documents and memos from app data
- Generate PDF templates with OpenAI or Claude
- PDF generation, document data and API-key security
- PDF template editor or a simple Generate PDF button?