Step 6: Name the product¶
The barcode already pulls from the package record. Now put the product name on the label the same way.
- Add a
Textelement. - Set X Start to
5%, X End to95%. - Set Y Start to
19%, Y End to31%. - Set Value template to
{{ package.item.name }}. - Set Font to
Helvetica-Bold, Font size to11, and Resize Strategy toShrink Text.
package.item.namereaches one level deeper thanpackage.label. The item is a nested record on the package, so you walk to it with a dot. Anything Metrc stores on the package is reachable the same way.Product names vary in length, which is exactly when
Shrink Textearns its keep. Compare the longest and shortest names below: both fit their box.
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"
},
{
"name": "Logo",
"elementType": "IMAGE",
"xStartFraction": 0.25,
"xEndFraction": 0.75,
"yStartFraction": 0.84,
"yEndFraction": 0.98,
"valueTemplate": "{{ images['logo.png'] }}"
},
{
"name": "Product name",
"elementType": "TEXT",
"xStartFraction": 0.05,
"xEndFraction": 0.95,
"yStartFraction": 0.69,
"yEndFraction": 0.81,
"valueTemplate": "{{ package.item.name }}",
"paragraphFontName": "Helvetica-Bold",
"paragraphFontSize": 11,
"paragraphSpacing": 12,
"horizontalParagraphAlignment": "CENTER",
"paragraphTextResizeStrategy": "SHRINK_TEXT"
}
]
}
Next Steps¶
- Continue to step 7, Add the THC result.
- Back to step 5, Add your logo.
- All tutorial steps