Skip to content

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 ​

ItemWhat it is
LayoutMade for one table (a table can have as many layouts as you like). Its table cannot be changed later
Draft and activeA 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
PreviewOpens the PDF to look at. Nothing is kept
IssueMakes the PDF and keeps it as an attachment of the record. Each issue adds a new attachment (the earlier ones are kept)
IssuerThe "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 ​

  1. Sign in as a system administrator.
  2. Open "Feature Management".
  3. 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.

  1. Sign in as a system administrator.
  2. Open the "System Setting" page and press the [System Setting] button at the top right.
  3. 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".

"Settings: System" in the menu

The System Setting list

The list has these columns.

ColumnWhat it shows
NameThe name of the layout. Press it to open the edit page
TableThe table of the layout
State"Active" or "Draft"
Updated atWhen it was last saved
(button)[Make active] or [Back to draft]

The list of document layouts

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.

  1. In the list, press [New layout].
  2. Choose the "Table" and press [Next].
  3. Choose the "Kind of document": Quote, Order confirmation, Delivery note, Invoice or Receipt.
  4. Choose the columns of the table for each part of the document. Parts left empty are not printed.
  5. Check "Seal" to add the block that prints the seal of the issuer (checked at first).
  6. Press [Create the draft].
  7. The edit page opens. Check the content, preview it, then make it active.

The parts you can fill are:

PartWhat you can choose
Number, Date, Due date, Valid until, Delivery date, Subject, Addressee (customer), Notes, Amount received, ForA 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 linesA child table (one to many) of this table
Line: item, quantity, unit, unit price, amount, tax rateA 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).

New layout (choosing the table)

The kind of document and the column of each part

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.

ItemWhat it is
NameThe name of the layout (required, up to 100 characters)
Button labelThe 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.

Editing a layout

A mistake shown with its line number

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.

For a table with an active layout, the "Documents" button shows at the top right of the data page.

  1. Open the data page.
  2. Press [Documents]. The button label of each active layout shows.
  3. 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_name of the layout. Without it, it is document.pdf.

The [Documents] button of the data page

An example of a quote PDF

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 ​

KeyWhat it isDefault
schemaAlways 1 (required)-
tableThe table name (required). It cannot be changed later-
paperThe paper: size (A4, A5, B5, LETTER), orientation (P portrait, L landscape), margin_mm (0 to 50 mm)A4, portrait, 15 mm
fontembedded or cid0jp. See "Fonts" belowembedded
issuerThe code of the issuer to useThe default issuer
file_nameThe file name of the PDF (up to 200 characters). Values can be put in with {@value.column} and so ondocument
blocksThe 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.

ReferenceWhat it is
@value.columnA column of the record
@value.column.columnA column of the record that a "Select (From Table)" column points to (e.g. @value.customer.customer_name)
@loop.child_tableThe 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.columnA column of a line (only in the table of the lines)
@row.noThe number of the line (from 1)
@tax.subtotal, @tax.tax, @tax.total_with_taxThe subtotal, the tax and the total (tax incl.) from the table of the tax by rate. Needs a tax_summary block
@issuer.fieldA field of the issuer (name, postal_code, address, tel, fax, email, registration_number, bank_account, logo)
@system.date, @system.datetimeThe date / date and time the PDF is made

Blocks ​

Every block can have type (required) and visible (false: not printed).

Block (type)What it printsMain keys
titleThe title (e.g. Quote)text (required, up to 200 characters), align, size (default: center, normal)
textA fixed texttext (required, up to 2000 characters), align, size
issuerThe issuerissuer (code), show (the fields to show, up to 10), align. Without show: name, postal code, address, phone, registration number
sealThe seal of the issuerissuer, 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)
addresseeThe addresseename (required, @value…), suffix (up to 10 characters), lines (lines under it, up to 6)
fields"Label: value" itemsitems (required, 1 to 30, each with label, value, format), border (true: a table with lines)
itemsThe table of the linessource (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_summaryThe 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)
totalA large amount (e.g. Quote total)label, value (required), format
noteNoteslabel, value, text (value or text is required)
spacerA spaceheight_mm (required, 1 to 100)
two_columnsLeft and right columnsleft, 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 width of a column of items is its share of the width. Columns without it share the rest equally.

Formats (format) ​

formatShown as (example)
textAs it is
numberWith commas (1,234.5)
yenYen (¥1,234), rounded
date2026/12/01
date_ja2026年12月1日
percent10%
tax_markThe tax rate, with ※ for the reduced rate (8%※)

Example ​

An example of a quote (the table and column names are examples).

json
{
  "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.

fontWhat it does
embedded (default)Embeds only the letters used, from a TrueType font on the server. The PDF looks the same on any computer
cid0jpEmbeds 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 cid0jp even for embedded (no error).

We recommend IPAex Gothic (ipaexg.ttf). Its license (IPA Font License) lets it be embedded in PDFs.

  1. Put the TrueType file of IPAex Gothic (ipaexg.ttf) on the server (for example storage/app/fonts/ipaexg.ttf). The web server only needs to read it.
  2. 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 uses EXMENT_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}, order SO-…, delivery note D-…, invoice INV-…, receipt R-…; e.g. Q-202612-0001). The formats can be changed in the server settings (document_layout.number_formats in config/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 ​

ItemLimit
Size of the layout (JSON)65,536 bytes
Depth of the JSON12 levels
Blocks200 in all (100 at the top, 20 in each side of a two_columns)
Lines500 by default, up to 2,000 with max_rows
Pages of the PDF100
Logo and seal imagesPNG or JPEG, up to 2 MB
Name, button label100 characters

Permissions ​

ActionWho
Open the layouts page and the issuer page; make, edit, make activeSystem administrators
Preview a draft layoutPeople with the "Custom Table" (table management) permission on the table
Preview with an active layoutPeople who can see the record
Issue and keep as an attachmentPeople who can edit the record
Make a document with the sealSystem 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 ​

ProblemWhat to check
The layouts page returns 404Is "Document layouts" on (Feature Management)?
The layouts page returns 403Are you signed in as a system administrator?
No "Documents" button on the data pageIs 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 differentWith font embedded: the place of the font file (EXMENT_DOCUMENT_FONT_FILE), and whether storage/app/document_fonts is writable
No logo or sealIs 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