Receipt rolls / 80mm receipt roll
80mm thermal receipt PDF size
The 80mm roll is the standard point-of-sale receipt: 80 millimetres of paper, a printable width of about 72mm, and a length that depends on the order.
Where the size comes from
80mm is the media width; the print head is narrower. At the usual 203 dots per inch a common head is 576 dots wide, which is 72.1mm, and the remaining 8mm is the margin the mechanism needs to feed the paper straight. Designing to 80mm rather than 72mm is the single most frequent mistake with this format.
What gets printed at this size
- point-of-sale and restaurant receipts
- kitchen and bar order tickets
- queue tickets and collection slips
Margins that survive a real printer
3mm left and right, giving a 74mm content width that stays inside the 72mm print area on almost every head. Top and bottom margins are close to meaningless on a roll: the paper is cut where the content ends, so the practical rule is to leave 15mm of blank content at the foot so the cutter does not slice through the last line.
The CSS
80mm receipt roll is not one of the six named formats the API accepts, so the size has to come from the document. Declare it in the page box and set prefer_css_page_size in the request.
@page {
/* A roll has no fixed height. Declare a generous one and let the
content end where it ends; the cutter does the rest. */
size: 80mm 297mm;
margin: 0 3mm;
}
body {
margin: 0;
/* Thermal heads render one bit per dot. A monospace face at a size
that maps to whole dots stays crisp; a hairline serif does not. */
font-family: "IBM Plex Mono", "Courier New", monospace;
font-size: 9pt;
color: #000;
}
.total {
font-size: 12pt;
font-weight: 700;
}The render request
With a custom size the options carry no format at all: the one flag tells the renderer to use the page box the document declares.
{
"html": "<!doctype html>...",
"options": {
// No named format. The page box in the document's own CSS is the
// size, and this flag is what tells the renderer to use it.
"prefer_css_page_size": true
}
}The mistake people make
Using a grey background or a light rule to separate sections. Thermal paper has no greys, so a 20 percent grey becomes a dither pattern that looks like dirt and fades within months. Use a solid black rule or white space.
Frequently asked
How do I set a size the API has no name for?
Declare the rectangle in the document's own CSS page box, in millimetres or inches, and set prefer_css_page_size on the request. Do not also pass a named format: the two disagree and you should not have to know which wins.
Can I pass 80mm receipt roll as a format?
No. The API accepts six named formats: A4, A3, A5, Letter, Legal and Tabloid. 80mm receipt roll is reached through the document's page box with prefer_css_page_size set, which is a supported path and not a workaround.
Does landscape need a different page size?
No. Landscape is the same rectangle turned, so it is set as an orientation rather than as swapped dimensions. Writing the width and height the other way round produces the same page and makes the intent harder to read later.
Other page sizes
Sizes that come up in the same conversation, and one from each of the other families.
58mm thermal receipt PDF size and page setup
The 58mm roll is the narrow receipt used by mobile and handheld printers, with a printable width of roughly 48mm.
A4 page size for PDF generation
A4 is the default page for business documents everywhere except North America, and the default this API uses when no format is given.
US Letter page size for PDF generation
Letter is 8.5 by 11 inches and it is the default page in the United States, Canada, Mexico, Chile and the Philippines.
4x6 shipping label PDF size
The 4 by 6 inch label is the standard thermal shipping label accepted by every major carrier, and the most common non-paper page size an API renders.
Business card PDF size and bleed
85.6 by 53.98 millimetres is the ID-1 rectangle: the size of a bank card, and the business card standard across most of the world.
DL envelope PDF size and window position
DL is 220 by 110 millimetres, the standard business envelope in Europe, and it takes an A4 sheet folded in three.
30-per-sheet address label PDF template
Thirty 2.625 by 1 inch labels in a 3 by 10 grid on a Letter sheet, which is the most common laser address label stock in North America.
Every page size, with dimensions
The full list, grouped by what the size is for.
Paste the CSS below into the playground and see the page box it produces.