Document layouts
Make quotes, invoices, delivery notes, receipts and other documents as PDF files from your data. You need no Excel or PDF template and no outside service. You set the layout on the screen.
A layout is data only: a fixed set of "blocks" and the columns they show. No code (PHP, HTML, formulas) runs.
This page is for system administrators who make layouts, and for the people who print documents from the data pages.
Note: This feature is available in Exment v7.3.0 or later.
Note: It is off at first. A system administrator turns on "Document layouts" in "Feature Management". While it is off, no layout or issuer can be saved or changed (what is saved is kept), and the "Documents" button does not show on the data pages.
The name, address, registration number, bank account, logo and seal of your company printed on the documents are set in "Issuers". Register the issuer first.
How it works
| Item | What it is |
|---|---|
| Layout | Made for one table (a table can have as many layouts as you like). Its table cannot be changed later |
| Draft and active | A layout is always saved as a "draft". When a system administrator presses "Make active", the "Documents" button shows on the data pages of its table |
| Preview | Opens the PDF to look at. Nothing is kept |
| Issue | Makes the PDF and keeps it as an attachment of the record. Each issue adds a new attachment (the earlier ones are kept) |
| Issuer | The "issuer" block of a document shows the issuer |
- An issued PDF is recorded with the SHA-256 (hash) of its content, so that you can later check that the file is still the one issued.
- When you delete a layout, the documents issued from it (the attachments) stay.
Turn the feature on
- Sign in as a system administrator.
- Open "Feature Management".
- Set "Document layouts" to on and save.
While it is off, the layouts page and the issuer page return 404.
Open the layouts page
Only system administrators can open the layouts page.
- Sign in as a system administrator.
- Open the "System Setting" page and press the [System Setting] button at the top right.
- In the list, press "Document layouts" (the URL is
/admin/document_layout).
Note: from Exment v7.3.1, with "Menu" shown in Feature Management, "Settings: System" in the menu has the rows "Document layouts" and "Document issuer".


The list has these columns.
| Column | What it shows |
|---|---|
| Name | The name of the layout. Press it to open the edit page |
| Table | The table of the layout |
| State | "Active" or "Draft" |
| Updated at | When it was last saved |
| (button) | [Make active] or [Back to draft] |

Make a new layout
A layout is made from a preset of a kind of document. You only choose which column of the table goes in each part.
- In the list, press [New layout].
- Choose the "Table" and press [Next].
- Choose the "Kind of document": Quote, Order confirmation, Delivery note, Invoice or Receipt.
- Choose the columns of the table for each part of the document. Parts left empty are not printed.
- Check "Seal" to add the block that prints the seal of the issuer (checked at first).
- Press [Create the draft].
- The edit page opens. Check the content, preview it, then make it active.
The parts you can fill are:
| Part | What you can choose |
|---|---|
| Number, Date, Due date, Valid until, Delivery date, Subject, Addressee (customer), Notes, Amount received, For | A column of the table. For a "Select (From Table)" column, the columns of the table it points to too (e.g. Customer › Company name) |
| Table of the lines | A child table (one to many) of this table |
| Line: item, quantity, unit, unit price, amount, tax rate | A column of the child table chosen in "Table of the lines" |
- Without a table of the lines, the table of the lines and the table of the tax by rate are left out.
- What the issuer shows follows the kind: the registration number on delivery notes, invoices and receipts; the bank account on invoices only.
- On invoices and receipts, the seal is pressed over the name of the issuer (on the other kinds, it is under the issuer on the right).


Make the documents of the sales pack at once
When the site has the tables of "Sales (CRM / SFA)" (quote, order, delivery note, invoice, receipt) and one of them has no layout yet, the list shows the [Make the documents of the sales pack] button.
It makes draft layouts, only for the tables without a layout, with the columns already chosen. Check them, then make them active.
See also "Sales (CRM / SFA)".
Edit a layout
Press the name of a layout in the list to open the edit page. The table and the state show at the top.
| Item | What it is |
|---|---|
| Name | The name of the layout (required, up to 100 characters) |
| Button label | The name shown in the "Documents" button of the data page (up to 100 characters). Empty: the name of the layout |
| Layout (JSON) | The blocks and the columns they use, written as JSON. See "Writing a layout" below |
- [Save as a draft] checks the layout before saving. Mistakes are shown with their line numbers.
- Saving makes an active layout a draft again, and its button goes away from the data pages. Press [Make active] again.
- [Delete] deletes the layout. The documents issued (attachments) stay.


Preview
At the bottom of the edit page, enter the ID of a record of the table in "ID of the record to preview" and press [Preview]. The PDF opens in a new tab.
A draft can be previewed too (only by people with the "Custom Table" (table management) permission on the table).
Make active / back to draft
- [Make active] checks the layout again, then makes it active. The "Documents" button shows on the data pages of its table.
- If the layout no longer fits the table (for example, a column was deleted after it was saved), "Could not make it active." is shown and it stays a draft.
- [Back to draft] removes the button from the data pages.
Print a document (data page)
For a table with an active layout, the "Documents" button shows at the top right of the data page.
- Open the data page.
- Press [Documents]. The button label of each active layout shows.
- Press one of:
- [Preview]: the PDF opens in a new tab. Nothing is kept.
- [Issue and keep as an attachment]: press OK in the confirmation; the PDF is made and kept as an attachment of the record.
- [Preview] is for anyone who can see the record.
- [Issue and keep as an attachment] shows only for people who can edit the record.
- Deleted records (in the trash) have no button.
- The file name of the PDF follows the
file_nameof the layout. Without it, it isdocument.pdf.
![The [Documents] button of the data page](/docs/assets/d05_documents.BIzcT7H8.png)

Writing a layout
A layout is one JSON object. A layout made from a preset has it all already; change only what you need.
Top keys
| Key | What it is | Default |
|---|---|---|
schema | Always 1 (required) | - |
table | The table name (required). It cannot be changed later | - |
paper | The paper: size (A4, A5, B5, LETTER), orientation (P portrait, L landscape), margin_mm (0 to 50 mm) | A4, portrait, 15 mm |
font | embedded or cid0jp. See "Fonts" below | embedded |
issuer | The code of the issuer to use | The default issuer |
file_name | The file name of the PDF (up to 200 characters). Values can be put in with {@value.column} and so on | document |
blocks | The list of blocks (required, 1 to 100) | - |
Example: "file_name": "Quote_{@value.quote_no}". A file name cannot have \ / : * ? " < > |.
References to values
The values of the blocks are written as these "references". Nothing else can be written.
| Reference | What it is |
|---|---|
@value.column | A column of the record |
@value.column.column | A column of the record that a "Select (From Table)" column points to (e.g. @value.customer.customer_name) |
@loop.child_table | The records of a child table (one to many). For the source of the table of the lines and of the table of the tax by rate |
@row.column | A column of a line (only in the table of the lines) |
@row.no | The number of the line (from 1) |
@tax.subtotal, @tax.tax, @tax.total_with_tax | The subtotal, the tax and the total (tax incl.) from the table of the tax by rate. Needs a tax_summary block |
@issuer.field | A field of the issuer (name, postal_code, address, tel, fax, email, registration_number, bank_account, logo) |
@system.date, @system.datetime | The date / date and time the PDF is made |
Blocks
Every block can have type (required) and visible (false: not printed).
Block (type) | What it prints | Main keys |
|---|---|---|
title | The title (e.g. Quote) | text (required, up to 200 characters), align, size (default: center, normal) |
text | A fixed text | text (required, up to 2000 characters), align, size |
issuer | The issuer | issuer (code), show (the fields to show, up to 10), align. Without show: name, postal code, address, phone, registration number |
seal | The seal of the issuer | issuer, width_mm (5 to 50, default 20), align (default right), overlap (true: over the text), offset_x_mm, offset_y_mm (0 to 100), opacity (20 to 100, default 85) |
addressee | The addressee | name (required, @value…), suffix (up to 10 characters), lines (lines under it, up to 6) |
fields | "Label: value" items | items (required, 1 to 30, each with label, value, format), border (true: a table with lines) |
items | The table of the lines | source (required, @loop…), columns (required, 1 to 12, each with label, value (@row…), format, align, width), sort (the column to sort by), max_rows (1 to 2000, default 500) |
tax_summary | The table of the tax by rate (the totals by rate of a qualified invoice) | source, amount, rate (required), price_mode (exclusive / inclusive, default exclusive), rounding (floor, round, ceil, default floor) |
total | A large amount (e.g. Quote total) | label, value (required), format |
note | Notes | label, value, text (value or text is required) |
spacer | A space | height_mm (required, 1 to 100) |
two_columns | Left and right columns | left, right (required, up to 20 each). A two_columns cannot be inside a two_columns |
align:left,center,right.size:small,normal,large.- A layout can have only one
tax_summary. Rows of the reduced rate (8%) get "※", and a note shows under the table. - The
widthof a column ofitemsis its share of the width. Columns without it share the rest equally.
Formats (format)
format | Shown as (example) |
|---|---|
text | As it is |
number | With commas (1,234.5) |
yen | Yen (¥1,234), rounded |
date | 2026/12/01 |
date_ja | 2026年12月1日 |
percent | 10% |
tax_mark | The tax rate, with ※ for the reduced rate (8%※) |
Example
An example of a quote (the table and column names are examples).
{
"schema": 1,
"table": "sales_quote",
"paper": { "size": "A4", "orientation": "P", "margin_mm": 15 },
"file_name": "Quote_{@value.quote_no}",
"blocks": [
{ "type": "issuer", "show": ["logo"], "align": "right" },
{ "type": "title", "text": "Quote", "size": "large" },
{ "type": "two_columns",
"left": [
{ "type": "addressee", "name": "@value.customer.customer_name" },
{ "type": "fields", "items": [
{ "label": "Quote No.", "value": "@value.quote_no" },
{ "label": "Quote date", "value": "@value.quote_date", "format": "date" }
] }
],
"right": [
{ "type": "issuer", "show": ["name", "postal_code", "address", "tel", "email"] },
{ "type": "seal", "width_mm": 18, "align": "right" }
] },
{ "type": "total", "label": "Quote total (tax incl.)", "value": "@tax.total_with_tax", "format": "yen" },
{ "type": "items", "source": "@loop.sales_quote_detail", "columns": [
{ "label": "No.", "value": "@row.no", "width": 6, "align": "center" },
{ "label": "Item", "value": "@row.item_name", "width": 44 },
{ "label": "Quantity", "value": "@row.quantity", "format": "number", "align": "right" },
{ "label": "Unit price", "value": "@row.unit_price", "format": "yen", "align": "right" },
{ "label": "Amount", "value": "@row.amount", "format": "yen", "align": "right" },
{ "label": "Tax rate", "value": "@row.tax_rate", "format": "tax_mark", "align": "center" }
] },
{ "type": "tax_summary", "source": "@loop.sales_quote_detail", "amount": "@row.amount", "rate": "@row.tax_rate" },
{ "type": "note", "label": "Notes", "value": "@value.note" }
]
}Fonts
font sets the letters of the PDF.
font | What it does |
|---|---|
embedded (default) | Embeds only the letters used, from a TrueType font on the server. The PDF looks the same on any computer |
cid0jp | Embeds no font. The file is smaller, but the shape of the letters is left to the PDF viewer |
To use embedded, the server administrator writes the place of the font file (TrueType) in .env.
EXMENT_DOCUMENT_FONT_FILE=/path/to/font.ttf- Use a Japanese font whose license allows embedding it in PDFs (IPAex Gothic, Noto Sans JP...).
- The font is converted the first time it is used and kept in
storage/app/document_fonts. Make this folder writable. - When the font file is missing or cannot be read, the PDF is made with
cid0jpeven forembedded(no error).
We recommend IPAex Gothic (ipaexg.ttf). Its license (IPA Font License) lets it be embedded in PDFs.
- Put the TrueType file of IPAex Gothic (
ipaexg.ttf) on the server (for examplestorage/app/fonts/ipaexg.ttf). The web server only needs to read it. - Write its place in
.env:
EXMENT_DOCUMENT_FONT_FILE=/var/www/exment/storage/app/fonts/ipaexg.ttf- Without it, the PDF is made with
cid0jp: on a computer without a Japanese font, the Japanese text may not show. - On Exment SaaS, the host sets it.
- Documents in Vietnamese and other languages: a Japanese font has no accented Vietnamese letters. From Exment v7.3.1, a font can be set for each language. The font of the language of the document is used (the language of its layout, else of the site), not of the person who looks at it. For Vietnamese, write a font with those letters (such as Noto Sans) in
EXMENT_DOCUMENT_FONT_FILE_VI. For a document that mixes Vietnamese and Japanese, use a font that has both (other languages:EXMENT_DOCUMENT_FONT_FILE_EN,_ZH_CN...; a language without its own usesEXMENT_DOCUMENT_FONT_FILE). A letter the font has not is logged as a warning. - In v7.3.0, a PDF of a Vietnamese document may miss some letters.
Numbers and amounts (sales pack)
While "Document layouts" is on, the tables of the sales pack (quote, order, delivery note, invoice, receipt) get these values when saved:
- An empty number gets a number (default: quote
Q-{YYYY}{MM}-{SEQ:4}, orderSO-…, delivery noteD-…, invoiceINV-…, receiptR-…; e.g. Q-202612-0001). The formats can be changed in the server settings (document_layout.number_formatsinconfig/exment.php). - An empty due date of an invoice is set from the payment term (the customer's, else the "Payment term" of the issuer).
- The amount of a line is quantity × unit price. The subtotal, tax and total come from the lines.
- A number or a due date entered by a person or a plugin is never changed.
To change the form of the numbers, the server administrator changes config/exment.php (not .env). If the site has no config/exment.php, copy vendor/exceedone/exment/config/exment.php to config/exment.php first, then change document_layout.number_formats. If the config is cached, run php artisan config:cache afterwards.
Limits
| Item | Limit |
|---|---|
| Size of the layout (JSON) | 65,536 bytes |
| Depth of the JSON | 12 levels |
| Blocks | 200 in all (100 at the top, 20 in each side of a two_columns) |
| Lines | 500 by default, up to 2,000 with max_rows |
| Pages of the PDF | 100 |
| Logo and seal images | PNG or JPEG, up to 2 MB |
| Name, button label | 100 characters |
Permissions
| Action | Who |
|---|---|
| Open the layouts page and the issuer page; make, edit, make active | System administrators |
| Preview a draft layout | People with the "Custom Table" (table management) permission on the table |
| Preview with an active layout | People who can see the record |
| Issue and keep as an attachment | People who can edit the record |
| Make a document with the seal | System administrators, and the people in the "Role groups that may use the seal" of the issuer |
- A document shows only the values the person who prints it can see.
- When a person who may not use the seal prints a document from a layout with a seal block, "You have no permission to use the seal of the issuer "…"." is shown and nothing is made.
Troubleshooting
| Problem | What to check |
|---|---|
| The layouts page returns 404 | Is "Document layouts" on (Feature Management)? |
| The layouts page returns 403 | Are you signed in as a system administrator? |
| No "Documents" button on the data page | Is the layout "Active"? Saving makes it a draft again. Is the record deleted (in the trash)? |
| No [Issue and keep as an attachment] | Can you edit the record? |
| "This layout is a draft. Make it active first." | Make the layout active |
| "There is no issuer. Register one." | Register the issuer |
| "You have no permission to use the seal of the issuer "…"." | Are you in the "Role groups that may use the seal" of the issuer? Or remove the seal block from the layout |
| "The layout does not fit the table now: …" | Was a column or table deleted or changed after saving? Fix and save the layout, then make it active again |
| "Too many lines (up to …)." | Raise max_rows of the table of the lines (up to 2,000) |
| "Too many pages (up to 100)." | Split the lines so the PDF has 100 pages or fewer |
| "The table of a layout cannot be changed. Make a new layout." | table cannot be changed. Make a new layout |
| "@tax needs a block of the tax by rate (tax_summary)." | Add a tax_summary block |
| Japanese letters are boxes or look different | With font embedded: the place of the font file (EXMENT_DOCUMENT_FONT_FILE), and whether storage/app/document_fonts is writable |
| No logo or seal | Is the image PNG or JPEG, up to 2 MB? Does an issuer block have logo in show? |
| Issuer fields are empty | "What each document still needs" on the issuer page |
