Skip to content

Step 4: Show the tag number

A barcode is for scanners. Add the digits underneath for people.

  1. Add a Text element.
  2. Set X Start to 5%, X End to 95%.
  3. Set Y Start to 55%, Y End to 62%.
  4. Set Value template to {{ package.label | boldEndingDigits }}.
  5. Set Font size to 7 and Resize Strategy to Shrink Text.

The | boldEndingDigits part is a filter: it transforms the value on its way onto the label. This one bolds the significant digits at the end of a Metrc tag, so a human can read the part that actually differs between packages. See Filters for the rest.

Resize Strategy decides what happens when text does not fit. Shrink Text steps the font down until it does. The alternatives are Truncate Text, which cuts and adds an ellipsis, and Allow Overflow, which lets it spill. All three are compared side by side.

Labels with the tag number below the barcode

Printed PDF • Layout JSON

Behind the scenes
{
  "name": "Tutorial label",
  "labelContentLayoutElements": [
    {
      "name": "Tag barcode",
      "elementType": "CODE128_BARCODE",
      "xStartFraction": 0.05,
      "xEndFraction": 0.95,
      "yStartFraction": 0.46,
      "yEndFraction": 0.66,
      "valueTemplate": "{{ package.label }}"
    },
    {
      "name": "Tag number",
      "elementType": "TEXT",
      "xStartFraction": 0.05,
      "xEndFraction": 0.95,
      "yStartFraction": 0.38,
      "yEndFraction": 0.45,
      "valueTemplate": "{{ package.label | boldEndingDigits }}",
      "paragraphFontName": "Helvetica",
      "paragraphFontSize": 7,
      "paragraphSpacing": 8,
      "horizontalParagraphAlignment": "CENTER",
      "paragraphTextResizeStrategy": "SHRINK_TEXT"
    }
  ]
}

Next Steps