Barcode reader

Module for recognizing barcodes

See also: Barcode Erkennung (in documents)

Event action – Abstract

Purpose: Detects the barcodes contained from an input document.

The 'Barcode reader' event action detects barcodes from a document and groups them under one or more documents. The detected barcodes are stored in a list under temporary values. Each list entry contains a barcode result object that stores the barcode, its format, and the page on which the barcode was found.

Configuration

images/download/attachments/137301090/image-2023-6-6_7-49-44-version-1-modificationdate-1686030583258-api-v2.png

Document content

The Document content parameter must provide the document via a value resolver.

Result

A Result variable must be defined via a value resolver, and the documents are stored under this variable.

Barcode filter

Barcode filters are defined by a value resolver. A list of barcode filters is expected. Barcode filters decide which of the barcodes recognized in a file should be processed further. Without a filter, all found barcodes are taken into account. Each barcode filter can contain a default for the Format of the barcode with a regular expression (RegEx). Both criteria are optional. They are AND-linked within the same filter. If several barcode filters are defined, they are OR-linked. A recognized barcode is therefore processed further if it meets all specified criteria for at least one filter.

Barcode pattern

The Barcode pattern is defined by a value resolver. A barcode pattern defines an extended interpretation scheme for the string from the barcode by a combination of plain text (e.g. separators) and placeholders for sections to be included in properties of the document.

See also: Barcode Erkennung (in documents)

Combine barcodes in one document?

This option must be defined via a value resolver. If the barcodes are to be summarized in a document, all recognized barcodes are stored in a list named after the variable defined in result as temporary values under the document.

In combination with 'Split document', the recognized barcodes for each of the saved documents are saved as a list under temporary values.

Split document?

This option must be defined via a value resolver. For each barcode, only one section (in which the barcode was recognized) from the entire document is saved and assigned as a (partial) document.

See also: Barcode Erkennung (in documents)

Skip barcode page?

This option must be defined via a value resolver. The Skip barcode page? option works only in conjunction with the Split document? option. This option controls which pages appear as a partial document.

See also: Barcode Erkennung (in documents)

Example

Configuration:

No events or rules have been defined for Triggering events or for the Validating rule.

Actions on passed rule:

  • In 'Set values', a barcode filter instance is created and the values are stored under the variable named 'bcf'. Under 'Target values', 'format' and 'regex', the barcode format can be set. In this example, a barcode filter is created for the barcode format 'Code 128'. This means that it will filter for all entries with this format.


  • In a similar way, another 'Set values' is created where the barcode filter values are stored under the variable 'bcf2'. The first entry is a filter based on the barcode format 'Code 39', and the second entry is a regex filter. The regex filter specifies that only barcodes should be outputted that start with any alphanumeric sequence but must end with 2 digits.




  • Finally the event action barcode reader follows

    • A file reference with a file path of a PDF file with barcodes is entered for the value of the Document content parameter.


    • The variable name 'result' is set for the Result parameter.


    • In the Barcode filter parameter, the barcode filters defined above are set in a generated list.

    • Another option checked is Combine barcodes in one document?


images/download/attachments/137301090/image-2023-6-6_7-53-6-version-1-modificationdate-1686030786148-api-v2.png images/download/attachments/137301090/image-2023-6-6_7-55-56-version-1-modificationdate-1686030956831-api-v2.png

Result:

The following section is displayed in test mode under the 'Variables' tab:

<entry>
<key xsi:type="xsd:string"> result</key>
<value xsi:type="list">
<entry name="BarcodeExamples.pdf" description="Detected Barcodes:CODE39;123ABCabc" size="0" reference="" xsi:type="doc:Document">
<temporaryValues>
<data>
<entry>
<key xsi:type="xsd:string">barcodeResults</key>
<value xsi:type="list">
<entry barcode="CODE39" format="CODE_39" page="0" xsi:type="doc:BarcodeResult"/>
<entry barcode="123ABCabc" format="CODE_128" page="1" xsi:type="doc:BarcodeResult"/>
</value>
</entry>
</data>
</temporaryValues>
<documentContent>JVBERi0xLjcKCjQgMCBvYmoKKElkZW50aXR5KQplbmRvYmoKNSAwIG9iagooQWRvYmUpCmVuZG9iago4IDAgb2JqCjw8Ci9GaWx0ZXIgL0ZsYXRlRGVjb2RlCi9MZW5ndGggMTc4MzIwCi9MZW5ndGgx...=</documentContent>
<attributes/>
</entry>
</value>
</entry>

→ Evaluation:

In the example document, barcodes are stored on several pages, sometimes one or more barcodes per page. A document is created and the barcode information found is stored under temporary values. The fact that only one document was created is because of the selected option 'Combine barcodes in one document'. The fact that only two barcodes are in the list is due to the barcode filters created. If the 'Split document?' option had also been selected here, a document would have been created for pages with multiple barcodes and an entry would have been entered in the list under temporary values for each recognized barcode. Otherwise, if only 'Split document?' is selected, one document is created per recognized barcode.