Set barcode bar width.
public setBarcodeWidth ( integer $width = 3 ) | ||
$width | integer | Bar width in dots. If not specified, 3 will be used. Values above 6 appear to have no effect. |
/* Height and width */ $printer->selectPrintMode(Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_DOUBLE_WIDTH); $printer->text("Height and bar width\n"); $printer->selectPrintMode(); $heights = array(1, 2, 4, 8, 16, 32); $widths = array(1, 2, 3, 4, 5, 6, 7, 8); $printer->text("Default look\n"); $printer->barcode("ABC", Printer::BARCODE_CODE39); foreach ($heights as $height) { $printer->text("\nHeight {$height}\n"); $printer->setBarcodeHeight($height); $printer->barcode("ABC", Printer::BARCODE_CODE39); } foreach ($widths as $width) { $printer->text("\nWidth {$width}\n"); $printer->setBarcodeWidth($width); $printer->barcode("ABC", Printer::BARCODE_CODE39); } $printer->feed(); // Set to something sensible for the rest of the examples $printer->setBarcodeHeight(40); $printer->setBarcodeWidth(2); /* Text position */ $printer->selectPrintMode(Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_DOUBLE_WIDTH); $printer->text("Text position\n"); $printer->selectPrintMode(); $hri = array(Printer::BARCODE_TEXT_NONE => "No text", Printer::BARCODE_TEXT_ABOVE => "Above", Printer::BARCODE_TEXT_BELOW => "Below", Printer::BARCODE_TEXT_ABOVE | Printer::BARCODE_TEXT_BELOW => "Both"); foreach ($hri as $position => $caption) { $printer->text($caption . "\n"); $printer->setBarcodeTextPosition($position); $printer->barcode("012345678901", Printer::BARCODE_JAN13);