Linear Raw Mode

Raw linear barcode rendering in PHP: bar pattern input, code example and SVG output

This is a custom format rather than a published symbology. It allows a bar pattern computed elsewhere to be drawn as it is: the payload is the pattern itself, a string of 0 and 1 in which each 1 is one module of bar, and the library encodes nothing.

Type Token

ItemValue
Type tokenLRAW
Enum caseBarcodeType::LRAW
FamilyLinear
Class\Com\Tecnick\Barcode\Type\Linear\Raw

Input

ItemValue
Character set0 and 1
Length1 to 30000 characters
Checknone
Extra parametersnone

Examples

A bar pattern drawn as given

<?php

require_once __DIR__ . '/vendor/autoload.php';

$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
    type: 'LRAW',
    code: '0101010101',
    width: -3,
    height: -30,
    color: 'black',
    padding: [0, 0, 0, 0],
)->setBackgroundColor('white');

echo $bobj->getInlineSvgCode();

Linear Raw Mode barcode encoding 0101010101

Errors

These payloads raise \Com\Tecnick\Barcode\Exception:

PayloadMessage
1012The rows must only contain the characters 0 and 1: row 0 is “1012”
``Empty columns

See Also