Docmosis can generate and insert barcodes into documents.
Docmosis supports Code 39, Code 128 and ITF 14 formats.
Inserting barcodes with Docmosis uses a technique similar to inserting images.
To insert a barcode, start by inserting a placeholder image. This placeholder determines the size and position of the barcode in the resulting document.
In the template, mark the placeholder image with a meaningful name, for example "img_itemNumber".
In Microsoft Word: assign a Bookmark to identify the data used for the barcode's value.
In LibreOffice: the name of the image is used to identify the data.
To instruct Docmosis to generate a barcode image and replace the placeholder image, the data should include the "value", a ":" colon, and then the required barcode "format", for example (in JSON):
Docmosis will generate a code39 barcode for the value 90127123.
Instead of including the format in the data, you can include an optional barcode field within the template to set additional attributes for the barcode. This barcode field can be used to specify the barcode format and other attributes such as DPI.
For example, the following barcode field instructs Docmosis that a barcode using the data "itemNumber" should be in "code39" format: <<barcode:itemNumber:code39>
The barcode field can exist anywhere in the template. When the document is rendered, the value for "itemNumber" will be looked up and used to create the barcode.
The special field <<barcode:…>> will be removed from the final document.
The <<barcode>> field in the template can specify default settings for the barcode, including the value, resolution and more. The format and the value are the most common, so they can be specified as follows: <<barcode:name:value:format>>.
For example: <<barcode:barcode1:ABC123:code128>> specifies barcode1 to have a value of ABC123 and be of type code128. These settings will be overridden in the data if they are provided.
Other settings such as the resolution can be specified either as a default in the template-field or via the data values. These other settings are specified as key=value pairs.
For example, the resolution (dpi) can be specified by: <<barcode:barcode1:code128:dpi=1200>>. Such a setting (increased resolution) might be required for a small sized barcode.