PHP code example of radoid / pdf417

1. Go to this page and download the library: Download radoid/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/ */

    

radoid / pdf417 example snippets




use Radoid\PDF417\PDF417;
use Radoid\PDF417\Renderers\ImageRenderer;
use Radoid\PDF417\Renderers\SvgRenderer;

// Text to be encoded into the barcode
$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
imperdiet sit amet magna faucibus aliquet. Aenean in velit in mauris imperdiet
scelerisque. Maecenas a auctor erat.';

// Encode the data, returns a BarcodeData object
$pdf417 = new PDF417();
$data = $pdf417->encode($text);

// Create a PNG image
$renderer = new ImageRenderer();
$image = $renderer->render($data);

// Create an SVG image
$renderer = new SvgRenderer();
$svg = $renderer->render($data);

// Create a data URL
$dataURL = $renderer->renderDataUrl($data);

// Use custom options
$options = [
	'scale' => 3,
	'ratio' => 2,
	'padding' => 0,
]
$renderer = new ImageRenderer($options);