【问题标题】:PDF417 barcode in WordPressWordPress 中的 PDF417 条码
【发布时间】:2018-06-04 13:01:07
【问题描述】:

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

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

【问题讨论】:

    标签: php wordpress woocommerce barcode


    【解决方案1】:

    如果您可以在您的服务器上安装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;
    

    【讨论】:

    • 它给出什么样的输出?而 jow jeavy 对服务器本身来说是 zint 吗?
    • zint 非常快,因为它是一个原生的 linux 命令。该图像可以呈现为可移植网络图形 (PNG) 图像、封装后脚本 (EPS)(与 PDF 兼容)或可缩放矢量图形 (SVG)。
    • 你可以在这里找到手册zint.github.io 虽然只是调用我的代码更容易,但是我的代码暂时只是为了输出PNG而编写的。 (尽管请随意重构并发送拉取请求!;-))
    • 可以直接输出到php变量而不是文件吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多