doujiexi1824 2019-05-28 16:32
浏览 73

如何使用tc-lib-barcode指定诸如“X维度”和“Y维度”之类的参数

I am working on an API with a company that requires us to generate a PDF417 barcode. In the documentation they sent us, they ask that we use the following settings:

XDim = 0.02
YDim = 0.03
Bar Height = 0.30
Aspect = 0.25
Columns = 16 or 18
Rows = 0
ECC = 4
Containment area is about 1000 X 5000 unit of pixels

According to the sole example in the documentation of the tc-lib-barcode library I'm using, these are the parameters I can work with:

// generate a barcode
$bobj = $barcode->getBarcodeObj(
    'QRCODE,H',                     // barcode type and additional comma-separated parameters
    'https://tecnick.com',          // data string to encode
    -4,                             // bar width (use absolute or negative value as multiplication factor)
    -4,                             // bar height (use absolute or negative value as multiplication factor)
    'black',                        // foreground color
    array(-2, -2, -2, -2)           // padding (use absolute or negative values as multiplication factors)
    )->setBackgroundColor('white'); // background color

As you can see, the company and tc-lib-barcode use different names for the parameters, or perhaps tc-lib-barcode just doesn't provide support for the parameters I need to change. There is nothing in the tc-lib-barcode documentation about "XDim", "YDim", etc. So I'm trying the map the specifications from the company to the parameters in the tc-lib-barcode documentation.

According to the Wikipedia article on PDF417:

"The user can decide how wide the narrowest vertical bar (X dimension) is, and how tall the rows are (Y dimension)."

So perhaps XDim == bar width?

In \src\Type\Square\PdfFourOneSeven.php, I see:

 /**
     * Row height respect X dimension of single module
     *
     * @var int
     */
    protected $row_height = 2;

So I thought maybe YDim == $row_height. I changed $row_height to .03 but then I got an error (Undefined offset: 2 thrown by line 85 in \src\Type\Raw.php).

I seem to be going about this the wrong way and could really use some help. I have reached out to the company but they just tell me to buy one of 2 software packages that can produce a compatible barcode. The licenses are out of our budget and since PDF417 is an ISO standard, it shouldn't be impossible to produce a compatible barcode with virtually any software package.

I notice that in the first parameter of getBarcodeObj, you can pass "additional comma-separated parameters" but I see no documentation on what parameters, and in what order, you can pass there.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)