WordPress中的PDF417条形码

时间:2018-06-04 13:01:07

标签: php wordpress woocommerce barcode

如何在wordpress中生成PDF417条形码? 您将使用什么PHP库?如何从functions.php调用它? 这实际上是一个好的开始吗? 这是我发现的东西: https://github.com/tecnickcom/tc-lib-pdf

我的理想情况是将外部php库包含在functions.php文件中,然后使用转换为PDF417图像的参数调用它(最好是SVG,但PNG也可以)。

1 个答案:

答案 0 :(得分:0)

如果您可以在服务器上安装Zint,我已经创建了一个可以生成该条形码格式的PHP类。

https://github.com/delboy1978uk/php-zint

<?php

use Del\Barcode\Service\BarcodeService;

// Use [] instead of () if barcode has parenthesis
$barcodeNumber = '646496874646'; // <- whatever, not the real format

$path = realpath('/path/to/genration/folder'); // Where zint will dump the image (gets deleted after generation)
$barcodeService = new BarcodeService($path);

$image = $barcodeService->generate(
    BarcodeService::TYPE_PDF_417,
    $barcodeNumber
);

echo $image;
相关问题