public function pdf417Code($content, $width = 3, $heightMultiplier = 3, $dataColumnCount = 0, $ec = 0.1, $options = Printer::PDF417_STANDARD)
{
self::validateString($content, __FUNCTION__, 'content');
self::validateInteger($width, 2, 8, __FUNCTION__, 'width');
self::validateInteger($heightMultiplier, 2, 8, __FUNCTION__, 'heightMultiplier');
self::validateInteger($dataColumnCount, 0, 30, __FUNCTION__, 'dataColumnCount');
self::validateFloat($ec, 0.01, 4.0, __FUNCTION__, 'ec');
self::validateInteger($options, 0, 1, __FUNCTION__, 'options');
if ($content == "") {
return;
}
if (!$this->profile->getSupportsPdf417Code()) {
// TODO use software rendering via a library instead
throw new Exception("PDF417 codes are not supported on your printer.");
}
$cn = '0';
// Code type for pdf417 code
// Select model: standard or truncated
$this->wrapperSend2dCodeData(chr(70), $cn, chr($options));
// Column count
$this->wrapperSend2dCodeData(chr(65), $cn, chr($dataColumnCount));
// Set dot sizes
$this->wrapperSend2dCodeData(chr(67), $cn, chr($width));
$this->wrapperSend2dCodeData(chr(68), $cn, chr($heightMultiplier));
// Set error correction ratio: 1% to 400%
$ec_int = (int) ceil(floatval($ec) * 10);
$this->wrapperSend2dCodeData(chr(69), $cn, chr($ec_int), '1');
// Send content & print
$this->wrapperSend2dCodeData(chr(80), $cn, $content, '0');
$this->wrapperSend2dCodeData(chr(81), $cn, '', '0');
}