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 多电路系统共用电源的串扰问题
    • ¥15 shape_predictor_68_face_landmarks.dat
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料