TemplatesPaper size, margins and file name

Paper size, margins and file name

Copy page

Set the paper size, orientation and margin of a document template, and name the PDF with a Liquid file name pattern.

The page of a document and the name of its PDF are set per template, on the Settings tab of the editor. The preview follows every change at once.

Paper size

Paper size offers five sizes:

Size Width x height
A4 210 x 297 mm
A5 148 x 210 mm
A6 105 x 148 mm
Letter 215.9 x 279.4 mm (8.5 x 11 in)
Legal 215.9 x 355.6 mm (8.5 x 14 in)

A new template uses A4. A5 and A6 suit packing slips and labels that go into a parcel.

Orientation

Select Landscape to turn the page: width and height trade places. Landscape suits wide tables, for example a product data sheet with many variant columns.

Margin

Margin is the white space on all four sides of every page, in millimeters, from 0 to 50. A new template uses 12 mm.

With a margin of 0 your content reaches the edge of the page. Most office printers cannot print to the edge, so keep a margin for documents that get printed.

Longer documents

A document has as many pages as its content needs. Size and margin apply to every page. Control where pages break with CSS on the CSS tab:

css
/* keep a table row on one page */
tr { page-break-inside: avoid; }

/* repeat the table head on every page */
thead { display: table-header-group; }

/* start a new page before this block */
.terms { page-break-before: always; }

Use Preview PDF to check page breaks. The on-screen preview shows the layout, the PDF shows the real pages.

File name

File name is the name of the PDF. It is a Liquid pattern with the same variables as the template, and ".pdf" is added for you. Examples:

css
Invoice {{ order.name }}
Packing slip {{ order.name }}
{{ product.handle }}
Customer {{ customer.name }}

The name is cleaned so it is safe to download on any system:

  • Letters, digits, dots, underscores and hyphens are kept. Other characters, such as # or /, are removed.
  • Spaces become hyphens.
  • Names longer than 120 characters are cut.
  • An empty result becomes document.pdf.

So the pattern Invoice followed by the order name gives Invoice-1001.pdf for order #1001.

The file name is what the Generate document action returns as filename and what you see when you download the PDF from Documents.

File name per language

Each added language of a template has its own file name, so the German version of an invoice can be named Rechnung and the English one Invoice. Paper size, orientation and margin are shared by all languages. See Templates in several languages.

Next steps