PDFPipe

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.

css
@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.

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

Paste the CSS below into the playground and see the page box it produces.