
Custom Document Types
Concept
The Document Editor is extensible. You can create new "Types" of documents (like the built-in Trial Balance or Invoice types) that can be selected in the editor. This allows you to create completely custom, data-driven PDF reports and documents.
Directory Structure
Each custom document type must have its own folder inside public/documents/type/. The folder name becomes the internal name of the type.
public/
└── documents/
└── type/
└── my_report/ <-- Your custom type folder
|-- type.json
|-- toolbar.json
|-- property.json
|-- objects.js
|-- fpdf.php
|-- dialog.json
`-- dialog.php
File Breakdown
- type.json: The manifest for your document type. It tells the editor the name of your type and which files to load for the toolbar, properties, etc.
- toolbar.json: Defines the custom buttons that appear in the editor's left-hand toolbar when your type is active.
- property.json: Defines the custom properties that appear in the right-hand panel when one of your custom objects is selected on the canvas.
- objects.js: Contains the JavaScript functions for creating your custom object, rendering its preview on the canvas, and handling property updates.
- fpdf.php: Contains the core PHP logic. For each custom object, you must write a `render...()` function that takes the object's data and uses FPDF commands to draw it onto the final PDF.
- dialog.json & dialog.php: These optional files work together to create the parameter pop-up that appears before a PDF is generated (e.g., to ask the user for a date range or a specific client).