tecnickcom/tc-lib-barcode

Methods getWidth and getHeight of the generated barcode

cheoAlejo opened this issue · 2 comments

When the barcode is generated using negative width/height (multiplication factor), it would be useful to be able to get the generated width and height.

Example:

$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
$bobj->getHtmlDiv();
$width = $bobj->getWidth();
$height = $bobj->getHeight();

The width and height parameters are already returned by the getArray() method.

Ok, understood.