承接 radoid/pdf417 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

radoid/pdf417

最新稳定版本:v1.0.0

Composer 安装命令:

composer require radoid/pdf417

包简介

A library for generating PDF417 barcodes in PHP

README 文档

README

This is a fork of the ihabunek/pdf417-php library, having the Intervention Image library removed for simplicity. It now relies on the PHP native GD extension only. Unneeded configuration options are also removed: bitmap image types (other than PNG) and colors (other than black on white).

Requirements

Requires the following components:

  • PHP >= 5.5
  • PHP extensions: bcmath, gd

Installation

Add it to your composer.json file:

composer require radoid/pdf417

Usage overview

require 'vendor/autoload.php';

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);

Options available

Option Default Description
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)

统计信息

  • 总下载量: 342
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 40
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-11