Template printing
Template printing fills a fixed-layout template with business data to generate contracts, orders, invoices, or reports. Provide an existing template and your business rules, and an application Agent can build the print entry point and file generation in your NocoBase app.
One important detail: @nocobase/app-plugin-template-print provides an Agent Skill and implementation references. It is not a print feature that you can enable at runtime. Installing it does not add print buttons, template management pages, or a rendering service. The Agent still needs to implement these features in the target app or a business plugin.
When to use it
- Generate a contract from an order, filled with the customer, amount, and line items.
- Select records from a list to create a shipping manifest.
- Generate a DOCX, XLSX, or PPTX file from an existing Office template.
- Add PDF output, images, or QR codes to an existing file-generation workflow.
If you only need to print the current page from a browser, the browser's print function is usually enough. Template printing is for generating files with a fixed layout that can be archived or sent to others.
What to prepare
- A target NocoBase app that your development Agent can read and modify.
- An actual template. If you do not have one, describe the layout and ask the Agent to create a sample for you to review.
- A representative business record with common fields, line items, and any values that may be empty.
- The print entry point, record scope, output format, and access rules you need.
This feature is not enabled on a Settings page. Ask your development Agent to check whether the template printing Skill is installed and synchronized for the current app:
After synchronization, the Agent can read the template printing guidance. Business users use the pages and buttons built for the app; they do not need to learn about Skills or run installation commands.
Example: generate a contract from an order
Give the actual DOCX template and a sample order to your Agent, then send the request below. Replace the bracketed details with the names and rules used in your app:
Expected result
The order detail page has a Print contract entry. When clicked, it downloads a DOCX containing the current order's data while preserving the template's layout and signature area.
For acceptance, use an order with several line items and check that the file opens in the target Office application. Also confirm that a user who cannot access the order cannot download its file.
Further use
Batch printing
Specify which records to include and how to organize the output. For example, create one XLSX shipping manifest for selected orders, sorted by order number:
"Current page," "selected records," and "all filtered results" are different print scopes. Tell the Agent which one to implement so the output does not include more records than expected.
Add PDF, images, or QR codes
Specify where an image should appear in the template, where a QR code should point, and which fonts and page breaks the PDF must preserve:
PDF conversion usually requires an additional server-side conversion environment and fonts. After downloading a PDF, users can choose a printer in their viewer. Sending a print job silently to a user's local printer requires a separate client-side implementation.
Let business users manage templates
Ask the Agent to add template management only if business users need to upload, replace, or choose templates:
Fixed templates can be maintained with the application code. Uploads, version management, template selection, and management permissions require additional implementation; installing the template printing Skill does not provide them automatically.
Things to keep in mind
- Specify whether printing applies to the current record, selected records, the current page, or all filtered results.
- DOCX, XLSX, PPTX, and PDF output depends on the renderer the Agent selects and integrates. Verify it with the actual template and deployment environment.
- PDF conversion may require an additional service and Chinese fonts. Checking only on a development machine is not enough.
- Before generating a file on the server, check the user's permissions before reading business data, templates, or attachments.
- The package only synchronizes guidance. After implementation, download a file from the actual app page and check its layout.
If no print button appears after installation, that is expected. First make sure the Skill is synchronized for the development Agent, then specify the business entry point, template, data scope, and output format you need.
Related links
- Writing requirements — Describe business rules and acceptance criteria to the application Agent.
- Files — Learn about uploads, attachments, and file access.
- Permissions — Understand access to data and features.

