Skip to content

PDF417

Raxos\Barcode\PDF417 encodes data as a PDF417 barcode with configurable columns and security level. It extends Barcode and inherits its properties and render methods.

Signature

php
final readonly class PDF417 extends Barcode

Methods

__construct

php
__construct(string $data, int $columns = 4, int $securityLevel = 2)

Builds a PDF417 barcode matrix for $data. The optional $columns sets the number of data columns (default 4), which affects the width and aspect ratio of the symbol. The optional $securityLevel (default 2) selects the amount of error correction. Internally the class uses PDF417Encoder, which is part of this package.

Inherited members

From Barcode: the data, format, height, width and matrix properties, and the renderPng and renderSvg methods. The format property is always BarcodeFormat::PDF417.

Example

php
<?php
declare(strict_types=1);

use Raxos\Barcode\PDF417;

$barcode = new PDF417('RAXOS-0001-EXAMPLE', columns: 6, securityLevel: 3);

$svg = $barcode->renderSvg(
    backgroundColor: '#ffffff',
    foregroundColor: '#111111'
);