2017 © Pedro Peláez
 

library pdf417

A library for generating PDF417 barcodes in PHP

image

bigfish/pdf417

A library for generating PDF417 barcodes in PHP

  • Tuesday, December 12, 2017
  • by ihabunek
  • Repository
  • 8 Watchers
  • 46 Stars
  • 8,318 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 7 Versions
  • 12 % Grown

The README.md

PDF 417 barcode generator

Latest Version Total Downloads License Author, (*1)

This project is no longer maintained

I have moved on from PHP and this project will no longer be updated. If you wish to continue the legacy, please fork the project., (*2)

For a maintaned Python implementation check out ihabunek/pdf417-py., (*3)

-- Ivan, (*4)

Requirements

Requires the following components:, (*5)

  • PHP >= 5.4
  • PHP extensions: bcmath, fileinfo, gd

Installation

Add it to your composer.json file:, (*6)

composer require bigfish/pdf417

Usage overview

require 'vendor/autoload.php';

use BigFish\PDF417\PDF417;
use BigFish\PDF417\Renderers\ImageRenderer;
use BigFish\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([
    'format' => 'png'
]);

$image = $renderer->render($data);

// Create an SVG representation
$renderer = new SvgRenderer([
    'color' => 'black',
]);

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

ImageRenderer

Renders the barcode to an image using Intervention Image, (*7)

Render function returns an instance of Intervention\Image\Image., (*8)

Options

Option Default Description
format png Output format, one of: jpg, png, gif, tif, bmp, data-url
quality 90 Jpeg encode quality (1-10)
scale 3 Scale of barcode elements (1-20)
ratio 3 Height to width ration of barcode elements (1-10)
padding 20 Padding in pixels (0-50)
color #000000 Foreground color as a hex code
bgColor #ffffff Background color as a hex code

Examples

$pdf417 = new PDF417();
$data = $pdf417->encode("My hovercraft is full of eels");

// Create a PNG image, red on green background, extra big
$renderer = new ImageRenderer([
    'format' => 'png',
    'color' => '#FF0000',
    'bgColor' => '#00FF00',
    'scale' => 10,
]);

$image = $renderer->render($data);
$image->save('hovercraft.png');

The data-url format is not like the others, it returns a base64 encoded PNG image which can be used in an image src or in CSS. When you create an image using this format:, (*9)

$pdf417 = new PDF417();
$data = $pdf417->encode('My nipples explode with delight');

$renderer = new ImageRenderer([
    'format' => 'data-url'
]);
$img = $renderer->render($data);

You can use it directly in your HTML or CSS code:, (*10)

<img src="<?= $img->encoded ?>" />

And this will be rendered as:, (*11)

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA.... " />

Thanks

Without these pages, implementation of this project would have been much harder:, (*12)

  • http://grandzebu.net/informatique/codbar-en/pdf417.htm
  • http://www.idautomation.com/barcode-faq/2d/pdf417/

The Versions

12/12 2017

dev-master

9999999-dev

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

29/07 2017

0.3.0

0.3.0.0

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

05/11 2016

dev-develop

dev-develop

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

05/05 2016

0.2.0

0.2.0.0

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

08/01 2015

0.1.2

0.1.2.0

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

26/12 2014

0.1.1

0.1.1.0

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

24/12 2014

0.1.0

0.1.0.0

A library for generating PDF417 barcodes in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires