PHP code example of leongrdic / pdf417

1. Go to this page and download the library: Download leongrdic/pdf417 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leongrdic / pdf417 example snippets


$pdf417 = new \Le\PDF417\PDF417;
$pdf417->setColumns(15); // optionally set the number of columns
$pdf417->setSecurityLevel(4); // optionally set the security level
$pdf417->setForceBinary(); // optionally force binary encoding

$content = 'Lorem ipsum dolor sit amet.';
$data = $pdf417->encode($content);


$imageRenderer = new \Le\PDF417\Renderer\ImageRenderer([
    // below are default values
    'format' => 'png', // jpg, png, gif, tif, bmp or data-url
    'quality' => 90, // jpeg quality 1-100
    'scale' => 3, // elements scale 1-20
    'ratio' => 3, // height to width aspect 1-10
    'padding' => 20, // padding in px 0-50
    'color' => '#000000', // elements color hex code
    'bgColor' => '#ffffff', // background color hex code
]);

$image = ->render($data)->render($data);
$image instanceof \Intervention\Image\Image; // true


$svgRenderer = new \Le\PDF417\Renderer\SvgRenderer([
    // below are default values
    'scale' => 3, // elements scale 1-20
    'ratio' => 3, // height to width aspect 1-10
    'color' => 'black', // elements color
]);

$svg = $svgRenderer->render($data);

BigFish\PDF417\PDF417                   =>  Le\PDF417\PDF417
BigFish\PDF417\Renderers\ImageRenderer  =>  Le\PDF417\Renderer\ImageRenderer
BigFish\PDF417\Renderers\SvgRenderer    =>  Le\PDF417\Renderer\SvgRenderer