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.