Find barcodes

This callas pdfToolbox property searches for any number of barcodes or matrix codes in the specified area for a rendering with given resolution.

Available since version 12

How is 'Find barcodes' different from 'Barcode is in area'?

'Find barcode' property can return any number of barcodes which shall be combined with other barcodes properties like 'Barcode value' or 'Symbology' (type of barcode/matrix code) and therefore can create multiple hits in contrast to the 'Barcode is in area' property that always only creates one hit per check.

Find barcodes property, in addition, enables:

  • finding barcodes/matrix codes for low-resolution scans or similar low-level quality originals
  • finding barcodes/matrix codes for pages with many barcodes very close to each other

'Find barcodes' property

  1. Area specified by: Two methods to define the search area:
    • Offset and width / height: "Relative to" sets the origin point. All subsequent parameters are based on this origin (e.g. if the origin point is set to top left corner, a negative vertical offset will move the origin down, while a positive offset will move the origin up).
    • Offsets to box edges (inwards - /outwards +): Takes the size of a page geometry box as a reference for the custom area. Negative values reduce the size of the page geometry box. Positive values increase the size.
  2. Units: Unit of measurement in cm, mm, inches, points or picas
  3. Smart resolution: Enables auto adjustment of the sample size for PDF files with at least one page dimension greater than 75 cm. Read more about Smart Resolution here.
  4. Resolution for rendering: Resolution of the (internally rendered) page image
  5. Filter for rendering:  Makes it possible to create a rendered page only based on the objects found by this filter.
  6. Symbologies: Supported barcode types (also shown below)
  7. Detection of low-quality barcodes: Checkbox to detect low-quality barcodes which makes the search about two times slower

The Barcode detection is performed on an internally rendered image of each page. Therefore only the coordinates are available (besides the determined details of the barcode). For this reason, found barcodes can not be handled by other Fixups (e.g. colors of a barcode can not be explicitly converted).

Trigger values

The trigger value of the "Find barcodes" Check is alway "is true". If you want to receive the code's parameters in the trigger values the Check needs to be combined with all other barcode Check properties in the group "Barcode/matrix code". How to do this is explained in this article: Read Barcode or Matrix code and determine properties.

Since pdfToolbox 15 you can get all properties of a barcode or matrix code in the result object (app.doc.result.checks[i].hits[h] ) under  "parameters" in JavaScript.

{
  "llx": 444.6780090332031,
  "lly": 332.3340148925781,
  "page": 0,
  "parameters": {
    "symbology": "QR Code",
    "value": "https://help.callassoftware.com/m/112122/l/1638294-training-manual-for-pdftoolbox-desktop",
    "barWidthReduction": 0.0050000000000022735,
    "moduleWidth": 2.315,
    "barRotation": 0
  },
  "triggers": [
    {
      "id": "BARCODE_Group::BARCODE_FindBarcodes",
      "value": true
    }
  ],
  "type": "Barcode",
  "urx": 539.5980224609375,
  "ury": 427.2539978027344
}
Click to copy

Note: If you want to have the quiet zone or color distance (includes color distance, barcode color and background color) properties in the result object, you must add the appropriate Check properties to the "Find Barcodes" Check. They are not provided by default because it takes some time to calculate the results.