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/01 15:14] – 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 83: | Line 90: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| + | ^ Warehouse-level ^^ | ||
| + | | '' | ||
| + | | '' | ||
| ^ Bin location-level ^^ | ^ Bin location-level ^^ | ||
| | '' | | '' | ||
| Line 167: | 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 181: | 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 268: | 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 318: | Line 336: | ||
| </ | </ | ||
| - | ====== Example template files ====== | + | ===== Example template files ===== |
| + | 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. | ||
| <code html> | <code html> | ||
| Line 330: | Line 351: | ||
| < | < | ||
| @page { | @page { | ||
| + | /* You can use width/ | ||
| + | /* For example, the following two are equivalent: */ | ||
| + | /* size: 148mm 105mm; */ | ||
| + | /* size: A6 landscape; */ | ||
| + | size: A6 landscape; | ||
| + | |||
| + | /* Don't change, use the container padding below. */ | ||
| margin: 0; | margin: 0; | ||
| padding: 0; | padding: 0; | ||
| } | } | ||
| - | html { | + | |
| + | body { | ||
| + | /* 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. The height should be minimally reduced to make | ||
| + | sure the HTML renderer doesn' | ||
| + | width: 148mm; | ||
| + | height: 104mm; | ||
| + | |||
| + | /* Don't change, use the container below. */ | ||
| margin: 0; | margin: 0; | ||
| padding: 0; | padding: 0; | ||
| - | font-family: sans-serif; | + | |
| - | | + | /* Useful to diagnose dimension issues. */ |
| + | outline: 0.5mm solid black; | ||
| + | | ||
| } | } | ||
| - | body { | + | |
| - | | + | .container |
| - | padding: 0; | + | |
| - | width: 98mm; | + | |
| - | | + | |
| position: relative; | position: relative; | ||
| + | width: 100%; | ||
| + | height: 100%; | ||
| + | |||
| + | font-family: | ||
| + | font-size: 18pt; | ||
| + | |||
| + | /* Global padding from the edges. */ | ||
| + | padding: 3mm; | ||
| } | } | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | <body> |
| + | <div class="container"> | ||
| - | <div style=" | + | |
| - | < | + | < |
| - | </ | + | </ |
| - | <div style=" | + | |
| - | <b>W:</b> @itemSalesWidth@ @itemSalesWidthUnit@ | + | <b>Price:</b> @itemPriceCurrencySymbol(1)@ @itemPriceFormattedValue(1)@ |
| - | </ | + | </ |
| - | <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=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | </ | ||
| </ | </ | ||
| </ | </ | ||
| </ | </ | ||
| - | ===== File 2 ===== | + | ==== File 2 ==== |
| + | |||
| + | This file demonstrates the use of user-input values and JavaScript integration. | ||
| <code html> | <code html> | ||
| Line 388: | Line 439: | ||
| < | < | ||
| @page { | @page { | ||
| + | /* You can use width/ | ||
| + | /* For example, the following two are equivalent: */ | ||
| + | /* size: 148mm 105mm; */ | ||
| + | /* size: A6 landscape; */ | ||
| + | size: A6 landscape; | ||
| + | |||
| + | /* Don't change, use the container padding below. */ | ||
| margin: 0; | margin: 0; | ||
| padding: 0; | padding: 0; | ||
| } | } | ||
| - | html { | + | |
| - | margin: 0; | + | |
| - | padding: 0; | + | |
| - | font-family: | + | |
| - | text-align: center; | + | |
| - | } | + | |
| body { | body { | ||
| + | /* 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. The height should be minimally reduced to make | ||
| + | sure the HTML renderer doesn' | ||
| + | width: 148mm; | ||
| + | height: 104mm; | ||
| + | |||
| + | /* Don't change, use the container below. */ | ||
| margin: 0; | margin: 0; | ||
| padding: 0; | padding: 0; | ||
| - | width: 98mm; | + | |
| - | | + | /* Useful to diagnose dimension issues. */ |
| + | outline: 0.5mm solid black; | ||
| + | | ||
| + | } | ||
| + | |||
| + | .container { | ||
| + | /* Don't change. */ | ||
| + | box-sizing: border-box; | ||
| position: relative; | position: relative; | ||
| + | width: 100%; | ||
| + | height: 100%; | ||
| + | |||
| + | font-family: | ||
| + | font-size: 18pt; | ||
| + | |||
| + | /* Global padding from the edges. */ | ||
| + | padding: 3mm; | ||
| } | } | ||
| </ | </ | ||
| <!-- Input definitions: | <!-- Input definitions: | ||
| - | @input(simpleInput[Insert value])@ | + | @input(text[Insert value])@ |
| - | @input(selectionInput[Select value]; | + | @input(selection[Select value]; |
| + | @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() |
| } | } | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | <body> |
| + | <div class="container"> | ||
| - | <div style=" | + | |
| - | < | + | < |
| - | </ | + | </ |
| - | <div style=" | + | |
| - | < | + | < |
| - | </ | + | </ |
| - | <div style=" | + | |
| - | @itemName@ | + | @itemName@ |
| - | </ | + | </ |
| - | <div style=" | + | <div style=" |
| - | @barcode(CODE_128,100,50, | + | @barcode(@input(codeFormat)@,150,75, |
| - | </ | + | </ |
| - | <div style=" | + | <div style=" |
| - | (90)@itemCode@(10)@batchNumber@ | + | (90)@itemCode@(10)@batchNumber@ |
| - | </ | + | </ |
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | < | ||
| + | | ||
| - | <div style=" | ||
| - | < | ||
| </ | </ | ||
| - | |||
| </ | </ | ||
| </ | </ | ||
| </ | </ | ||
cobi.wms/label_templates.1656681286.txt.gz · Last modified: by tkammer