|
1 | 1 | --- |
2 | 2 | displayed_sidebar: linuxSidebar |
3 | | -sidebar_label: JSON Settings |
| 3 | +sidebar_label: Configure barcode encoding |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | # Barcode Generator |
7 | 7 |
|
8 | | -The Barcode Generator is a simple API to generate barcodes directly from the Scandit SDK. This document describes the JSON format understood by the [`sc_barcode_generator_set_options()`](https://docs.scandit.com/stable/c_api/struct_sc_barcode_generator.html#a045a2b9474895067e8eb1610ae6c5fef) function. |
| 8 | +The Barcode Generator is a simple API to generate barcodes directly from the Scandit SDK. The function [`sc_barcode_generator_new`](https://docs.scandit.com/stable/c_api/struct_sc_barcode_generator.html) creates a barcode generator for a sepcific symbology. |
9 | 9 |
|
10 | | -## General Options |
| 10 | +The Barcode Generator supports the following formats: |
| 11 | + |
| 12 | +* Code 39 |
| 13 | +* Code 128 |
| 14 | +* EAN 13 |
| 15 | +* UPCA |
| 16 | +* ITF |
| 17 | +* QR |
| 18 | +* DataMatrix |
| 19 | +* PDF417 (SDK version >= 8.2) |
| 20 | + |
| 21 | +## Sample |
| 22 | + |
| 23 | +A C and Python sample is provided in the Linux SDK archive: `CommandLineBarcodeGeneratorSample.c/py`. |
| 24 | + |
| 25 | +## JSON Configuration |
| 26 | + |
| 27 | +The generator can be configured using a JSON string understood by the [`sc_barcode_generator_set_options()`](https://docs.scandit.com/stable/c_api/struct_sc_barcode_generator.html#a045a2b9474895067e8eb1610ae6c5fef) function. |
| 28 | + |
| 29 | +### General Options |
11 | 30 |
|
12 | 31 | * `foregroundColor`: 4-tuple of integers [r, g, b, a] with `r`, `g`, `b` and `a` being in the range [0, 255] |
13 | 32 | * `backgroundColor`: 4-tuple of integers [r, g, b, a] with `r`, `g`, `b` and `a` being in the range [0, 255] |
14 | 33 |
|
15 | | -## 2D Symbologies |
16 | | - |
17 | 34 | ### QR Code |
18 | 35 |
|
19 | 36 | * `errorCorrectionLevel`: string, may be `"L"` (up to 7% damage), `"M"` (up to 15% damage), `"Q"` (up to 25% damage) or `"H"` (up to 30% damage). Default correction level is `"M"`. |
20 | | -* `versionNumber`: positive integer, overrides desired version number. Version number is automatically chosen if not set. Barcode generation might fail if version number is too small. |
| 37 | +* `versionNumber`: integer from 1 to 40, overrides desired version number. Version number is automatically chosen if not set. Barcode generation might fail if version number is too small. |
| 38 | + |
| 39 | +Example: |
21 | 40 | ```json |
22 | 41 | { |
23 | 42 | "foregroundColor" : [ 255, 0, 0, 255 ], |
24 | 43 | "backgroundColor" : [ 0, 0, 255, 255 ], |
25 | 44 | "errorCorrectionLevel": "Q" |
26 | 45 | } |
27 | 46 | ``` |
| 47 | + |
| 48 | +### PDF417 |
| 49 | + |
| 50 | +All settings are optional. |
| 51 | + |
| 52 | +* `errorCorrectionLevel`: integer with values 0 to 8. A higher numbers increases the error correction data in the code. |
| 53 | +* `compact`: boolean, switches from normal to a compact code layout. |
| 54 | +* `compaction`: string, values `TEXT`, `BYTE`, `NUMERIC` or `AUTO`. |
| 55 | +* `dimensions`: object, `{"minCols" : n, "maxCols" : n, "minRows" : n, "maxRows" : n}` symbol dimensions as integer. Encoding fails if incompatible dimensions are defined. |
| 56 | + |
| 57 | +Example: |
| 58 | + ```json |
| 59 | + { |
| 60 | + "errorCorrectionLevel": 3, |
| 61 | + "compact": true, |
| 62 | + "dimensions" { |
| 63 | + "minCols" : 1, |
| 64 | + "maxCols" : 3, |
| 65 | + "minRows" : 2, |
| 66 | + "maxRows" : 10 |
| 67 | + } |
| 68 | + } |
| 69 | + ``` |
0 commit comments