Barcodes

A predefined Hublify twig-element can be included to generate a barcode-image (SVG).

In your twig-html-template, use:

...
    <div>
        {% include '@ecs/hublify/pdf/elements/_pdf--ele-barcode.html.twig' ignore missing with {
            'block': {
                'text': data.si_pcode,
                'format': 'CODE128',
                'displayValue': false,
            }
        } only %}
    </div>
...

Supported properties

{# 
  @param block - object|array with following properties:
     [text] - string (required) The actual barcode text-content.
 
     [format] - string (optional, default "auto" --> "CODE128")
         "auto"
 
         "CODE128"    (also for GS-1 encoding)
         "CODE128A"
         "CODE128B"
         "CODE128C"
 
          -- https://github.com/lindell/JsBarcode/wiki/EAN
         "EAN13"  (possible other options:    flat: true)
         "UPC"
         "EAN8"
         "EAN5"
         "EAN2"
 
         "CODE39"
 
         "ITF14"
 
         "pharmacode" -   (good:  width: 4, height: 40)
 
     [displayValue] - string (optional, default NULL). If "1" the encoded value will rendered also
                        beneath the barcode.
 
     [fontSize] - string/number (optional, default "10"). This is for the value displayed.
 
     [height] - string/number (optional, default "20").
 
     [width] - string/number (optional, default "1").
 
     [colorLine] - string (optional, default "#000000"). HexCode for the dark color.
 #}

QR-Codes

A predefined Hublify twig-element can be included to generate a qr-code-image (SVG).

In your twig-html-template, use:

...
    <div>
        {% include '@ecs/hublify/pdf/elements/_pdf--ele-qr-code.html.twig' ignore missing with {
            'block': {
                'text': 'myTextStrInTheCode!',
            }
        } only %}
    </div>
...

Supported properties

{# 
  @param block - object|array with following properties:
     [text] - string (required) The actual qr-code text-content.

     [width] - string/number (optional, default 128). The width of the QR-Code.

     [height] - string/number (optional, default 128). The height of the QR-Code.

     [colorDark] - string (optional, default "#000000"). HexCode for the dark color.

     [colorLight] - string (optional, default "#ffffff"). HexCode for the lighter color.

     [correctionLevel] - string (optional, default "L"). Correction-Level.
         The Four levels of Reed-Solomon error correction are referred to as L, M, Q and H. 
         The error correction levels allow verification of data and recovery in the event 
         that part of the symbol is damaged.

         Increasing the error correction level increases the symbol size and reduces data capacity.
         The percentage of recovery and capacity noted below are approximate. 
         To generate the smallest symbol choose error correction "L".

         Error Correction Level    % of Recovery     Byte Capacity at Size 24
         "L"                        7%                      1171
         "M"                       15%                       911
         "Q"                       25%                       661
         "H"                       30%                       511
 #}