cobi.wms:label_templates
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cobi.wms:label_templates [2022/07/19 17:23] – [Simple placeholders] tkammer | cobi.wms:label_templates [2023/06/19 13:59] (current) – tkammer | ||
---|---|---|---|
Line 16: | Line 16: | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | ||
- | | '' | ||
| '' | | '' | ||
| '' | | '' | ||
+ | ^ Based on document' | ||
+ | | '' | ||
+ | | '' | ||
^ Line-level ^^ | ^ Line-level ^^ | ||
| '' | | '' | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | + | | '' |
- | | '' | + | |
| '' | | '' | ||
| '' | | '' | ||
+ | ^ Based on line's unit ^^ | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
^ Item-level ^^ | ^ Item-level ^^ | ||
| '' | | '' | ||
Line 86: | Line 90: | ||
| '' | | '' | ||
| '' | | '' | ||
+ | ^ Warehouse-level ^^ | ||
+ | | '' | ||
+ | | '' | ||
^ Bin location-level ^^ | ^ Bin location-level ^^ | ||
| '' | | '' | ||
Line 170: | Line 177: | ||
</ | </ | ||
- | In this example, the first GS1 barcode field is '' | + | In this example, the first GS1 barcode field is '' |
- | The next field is '' | + | The next field is '' |
Here's a list of commonly used GS1 field identifiers: | Here's a list of commonly used GS1 field identifiers: | ||
Line 184: | Line 191: | ||
=== Better control of generated HTML === | === Better control of generated HTML === | ||
- | The '' | + | The '' |
+ | |||
+ | The '' | ||
+ | |||
+ | < | ||
+ | <img id=' | ||
+ | </ | ||
+ | |||
+ | The '' | ||
< | < | ||
- | <img id=' | + | <img id=' |
</ | </ | ||
- | The parameters of the '' | + | The parameters of the '' |
==== User-input values ==== | ==== User-input values ==== | ||
Line 271: | Line 286: | ||
</ | </ | ||
- | **NOTE:** Don't put any spaces before or after the parentheses or the separating | + | **NOTE:** Don't put any spaces before or after the parentheses or the separating |
- | This placeholder uses the pipe symbol instead of commas to separate its parameters, because the parameters themselves may contain commas. | + | This placeholder uses the vertical bar symbol instead of commas to separate its parameters, because the parameters themselves may contain commas. |
The mechanism is as follows: the text found within the '' | The mechanism is as follows: the text found within the '' | ||
Line 321: | Line 336: | ||
</ | </ | ||
- | ====== Example template files ====== | + | ===== Example template files ===== |
The following example files serve to demonstrate the syntax and some of the features. | The following example files serve to demonstrate the syntax and some of the features. | ||
- | ===== File 1 ===== | + | ==== File 1 ==== |
This is a very simple template demonstrating the use of placeholders to print the item code and name, price, and a timestamp. | This is a very simple template demonstrating the use of placeholders to print the item code and name, price, and a timestamp. | ||
Line 336: | Line 351: | ||
< | < | ||
@page { | @page { | ||
- | /* Set this to the width and height | + | /* You can use width/height, or a standardized size. */ |
- | size: 148mm 105mm; | + | |
+ | /* size: 148mm 105mm; */ | ||
+ | /* size: A6 landscape; */ | ||
+ | size: A6 landscape; | ||
- | /* Don' | + | /* Don' |
- | margin: 0; | + | |
- | padding: 0; | + | |
- | } | + | |
- | + | ||
- | html { | + | |
- | /* Don't touch these, modify | + | |
margin: 0; | margin: 0; | ||
padding: 0; | padding: 0; | ||
Line 351: | Line 363: | ||
body { | body { | ||
- | /* Repeat | + | /* We could use 100vw/100vh to cover the whole size declared with @page, but this doesn' |
+ | work with ZPL printing, so repeat the page dimensions explicitly. | ||
+ | use standardized sizes like A6 here. | ||
+ | sure the HTML renderer doesn' | ||
width: 148mm; | width: 148mm; | ||
- | height: | + | height: |
- | + | ||
- | /* If you want the label printed sideways, enable this. */ | + | |
- | /* NOTE: The negative value within translate() must equal the height value above! */ | + | |
- | / | + | |
- | / | + | |
- | /* Don' | + | /* Don' |
margin: 0; | margin: 0; | ||
padding: 0; | padding: 0; | ||
/* Useful to diagnose dimension issues. */ | /* Useful to diagnose dimension issues. */ | ||
- | | + | outline: 0.5mm solid black; |
- | | + | outline-offset: |
- | + | ||
- | /* It's best to use a generic sans-serif font. */ | + | |
- | font-family: | + | |
- | font-size: 1.5em; | + | |
} | } | ||
.container { | .container { | ||
- | /* Don't change | + | /* Don't change. */ |
box-sizing: border-box; | box-sizing: border-box; | ||
+ | position: relative; | ||
width: 100%; | width: 100%; | ||
height: 100%; | height: 100%; | ||
- | /* Set the global | + | |
+ | font-size: 18pt; | ||
+ | |||
+ | | ||
padding: 3mm; | padding: 3mm; | ||
} | } | ||
Line 387: | Line 397: | ||
<div class=" | <div class=" | ||
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
- | <div style=" | + | |
- | @itemName@ | + | @itemName@ |
- | </ | + | </ |
- | <div style=" | + | <div style=" |
- | @barcode(CODE_128, | + | @barcode(CODE_128, |
- | </ | + | </ |
- | <div style=" | + | <div style=" |
- | (90)@itemCode@(10)@batchNumber@ | + | (90)@itemCode@(10)@batchNumber@ |
- | </ | + | </ |
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
</ | </ | ||
Line 418: | Line 428: | ||
</ | </ | ||
- | ===== File 2 ===== | + | ==== File 2 ==== |
This file demonstrates the use of user-input values and JavaScript integration. | This file demonstrates the use of user-input values and JavaScript integration. | ||
Line 429: | Line 439: | ||
< | < | ||
@page { | @page { | ||
- | /* Set this to the width and height | + | /* You can use width/height, or a standardized size. */ |
- | size: 148mm 105mm; | + | |
+ | /* size: 148mm 105mm; */ | ||
+ | /* size: A6 landscape; */ | ||
+ | size: A6 landscape; | ||
- | /* Don' | + | /* Don' |
- | margin: 0; | + | |
- | padding: 0; | + | |
- | } | + | |
- | + | ||
- | html { | + | |
- | /* Don't touch these, modify | + | |
margin: 0; | margin: 0; | ||
padding: 0; | padding: 0; | ||
Line 444: | Line 451: | ||
body { | body { | ||
- | /* Repeat | + | /* We could use 100vw/100vh to cover the whole size declared with @page, but this doesn' |
+ | work with ZPL printing, so repeat the page dimensions explicitly. | ||
+ | use standardized sizes like A6 here. | ||
+ | sure the HTML renderer doesn' | ||
width: 148mm; | width: 148mm; | ||
- | height: | + | height: |
- | + | ||
- | /* If you want the label printed sideways, enable this. */ | + | |
- | /* NOTE: The negative value within translate() must equal the height value above! */ | + | |
- | / | + | |
- | / | + | |
- | /* Don' | + | /* Don' |
margin: 0; | margin: 0; | ||
padding: 0; | padding: 0; | ||
/* Useful to diagnose dimension issues. */ | /* Useful to diagnose dimension issues. */ | ||
- | | + | outline: 0.5mm solid black; |
- | | + | outline-offset: |
- | + | ||
- | /* It's best to use a generic sans-serif font. */ | + | |
- | font-family: | + | |
- | font-size: 1.5em; | + | |
} | } | ||
.container { | .container { | ||
- | /* Don't change | + | /* Don't change. */ |
box-sizing: border-box; | box-sizing: border-box; | ||
+ | position: relative; | ||
width: 100%; | width: 100%; | ||
height: 100%; | height: 100%; | ||
- | /* Set the global | + | |
+ | font-size: 18pt; | ||
+ | |||
+ | | ||
padding: 3mm; | padding: 3mm; | ||
} | } | ||
</ | </ | ||
+ | |||
<!-- Input definitions: | <!-- Input definitions: | ||
- | |||
@input(text[Insert value])@ | @input(text[Insert value])@ | ||
@input(selection[Select value]; | @input(selection[Select value]; | ||
@input(codeFormat[Barcode type]; | @input(codeFormat[Barcode type]; | ||
- | |||
--> | --> | ||
- | <!-- @useJavaScript@ --> | ||
< | < | ||
+ | // @useJavaScript@ | ||
window.onload = function() { | window.onload = function() { | ||
var insert = document.getElementById(' | var insert = document.getElementById(' | ||
insert.textContent = "Hello World!" | insert.textContent = "Hello World!" | ||
- | | + | cobiwms.print() |
} | } | ||
</ | </ | ||
Line 496: | Line 500: | ||
<div class=" | <div class=" | ||
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
- | <div style=" | + | |
- | @itemName@ | + | @itemName@ |
- | </ | + | </ |
- | <div style=" | + | <div style=" |
- | @barcode(@input(codeFormat)@, | + | @barcode(@input(codeFormat)@, |
- | </ | + | </ |
- | <div style=" | + | <div style=" |
- | (90)@itemCode@(10)@batchNumber@ | + | (90)@itemCode@(10)@batchNumber@ |
- | </ | + | </ |
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
- | <div style=" | + | |
- | < | + | < |
- | </ | + | </ |
</ | </ |
cobi.wms/label_templates.1658244226.txt.gz · Last modified: 2022/07/19 17:23 by tkammer