Forma PDF documentation

SDK integration guide

This guide covers the compiled Forma PDF SDK. PDF generation is browser-side. Your application is responsible for saving data and managing its users.

1. Add the SDK to your app

Unzip the purchased package and host the contents of sdk/ on your own HTTPS application. Keep the files together. Load the stylesheet before the JavaScript:

<link rel="stylesheet" href="/vendor/forma-pdf/forma-pdf.css">
<script src="/vendor/forma-pdf/forma-pdf.global.js"></script>
<div id="pdf-editor"></div>

2. Open a template

Use one of the supplied models or load the layout and values saved in your own database. The editor renders into a normal HTML element.

const template = FormaPDF.getTemplate('quotation')
const editor = FormaPDF.createEditor(
  document.getElementById('pdf-editor'),
  { layout: template.layout, values: template.values, locale: 'en' }
)

3. Save the document

Store these two JSON documents separately. Layout contains positions, appearance and bindings; values contains the document content.

const layoutJSON = JSON.stringify(editor.getEstruct())
const valuesJSON = JSON.stringify(editor.getValues())

Use editor.onChange() to connect your own save workflow. The SDK does not create a database, user account or automatic upload. Destroy the editor with editor.destroy() when its view is unmounted.

4. Generate the PDF

const pdf = await editor.generatePDF()

const model = FormaPDF.getTemplate('quotation')
await FormaPDF.downloadPDF(model.layout, model.values, 'quotation.pdf')

You can generate files without mounting an editor. For a document loaded from your system, validate the values first:

const result = FormaPDF.validateDocumentData(layout, customerData)
if (!result.valid) {
  showMissingFields(result.errors)
} else {
  await FormaPDF.downloadPDF(layout, customerData, 'document.pdf')
}

What the license covers

Embed the SDK in one production application, with development and staging copies for that application. Its users may create documents inside it. This does not grant the right to resell the standalone SDK or publish a generic PDF plugin for resale. See the license terms.

AI is optional

The compiled SDK supports a configurable GPT or Claude generation gateway. This purchase does not include a hosted gateway, provider credits or the source of our AI backend. Keep shared company API keys on your backend. Do not put them in a layout, frontend configuration or public Bubble property.

Supported scope

Version 0.4.0 supports A4 and Letter, text, PNG/JPEG data URLs, lines and tables, with up to 200 rows per table and 100 calculated pages. The interface supports English, Portuguese and Spanish; it does not translate document content. Totals are values provided by your application. Digital signatures, arbitrary HTML conversion, file hosting and email delivery are not included.