Skip to main content

Templates & PDFs

Who owns what​

Spring owns saved invoices, labels, and the invoice_template system setting. Laravel owns template file access, DOCX rendering, and PDF conversion.

The current production print origin is https://print.tigasatutiga.com. Generation paths intentionally do not use a Laravel /api prefix.

Choose a template​

With TEMPLATE_SOURCE=spring, Laravel reads the invoice_template setting and loads that filename from the configured storage disk.

TEMPLATE_DISK=templates_ftp uses the existing FTP template area. Use the full FTP account name supplied by the hosting configuration; a short username may fail even with the right password.

Keep the FTP password in environment/secret configuration. The docs do not contain account passwords or service-account keys.

Render a PDF​

POST /generate/invoice/SAMPLE-INVOICE
Content-Type: application/json

{
"INVOICE_NO": "SAMPLE-INVOICE",
"PARENT_NAME": "Example Parent",
"SUB_TOTAL": 80,
"invoiceItems": [
{
"student": {"name": "Example Student"},
"subject": {"subjectName": "Mathematics"},
"description": "Monthly tuition",
"amount": 80
}
]
}

This simplified example illustrates the shape; a real render should use Spring's complete invoice-template payload, including labels and company details. The filename is sanitized and the response is a PDF download.

Template compatibility​

The PHP renderer supports the legacy placeholder/loop flow used by the original DOCX templates. Rendering and conversion are separate: a correctly rendered DOCX can still produce a different PDF when a different conversion engine is used.

The current layout-preserving path is PDF_DRIVER=google, using Google Drive import/export. A Gotenberg option exists, but it must be checked visually against the same template before switching converters.

Storage and batch snapshots​

Template management exposes list, upload, download, and delete endpoints. Uploads are DOCX files. Relative paths are validated against traversal.

For a logical delivery batch, Laravel snapshots the chosen template into its persistent batch data. Editing an FTP template does not silently change the layout of an already accepted batch.

Use Print API reference for exact paths.