withDeterministic(new DeterministicSettings( new DateTimeImmutable('2026-07-24T00:00:00Z'), \str_repeat('6', 32), )); $doc = Document::createStandalone($config); $doc->setTitle('Barcode 1D Sample Sheet'); $doc->setPrintFooter(false); $doc->addPage(new PageSize(1400, 600, 'BarcodeSheet'), Orientation::Landscape); $doc->setFont('helvetica', 'B', 18); $doc->setXY(24, 20); $doc->cell(0, 12, 'Barcode 1D Sample Sheet', newLine: true); $caption = static function (Document $document, float $x, float $y, string $text): void { $document->setFont('helvetica', '', 7); $document->setXY($x, $y); $document->cell(430, 10, $text); }; $caption($doc, 24, 65, 'CELL itf14-default: ITF-14 / version=n/a / ECC=mod-10 / payload=10012345000017'); $doc->write1DBarcode('10012345000017', BarcodeType::ITF14, x: 32, y: 90, w: 260, h: 60); $caption($doc, 474, 65, 'CELL ean2-standalone: EAN-2 / version=n/a / ECC=parity / payload=12'); $doc->write1DBarcode('12', BarcodeType::EAN2, x: 482, y: 90, w: 100, h: 60); $caption($doc, 924, 65, 'CELL ean5-standalone: EAN-5 / version=n/a / ECC=checksum / payload=51234'); $doc->write1DBarcode('51234', BarcodeType::EAN5, x: 932, y: 90, w: 140, h: 60); // At 1.44 points per module, the widest 165X combined symbol fits its // declared sample crop and rasterizes to exactly 12 pixels per module. // ean_upc 4.3.7; reference_id=3eec7b60b04793c5c2b8f97c2bf2e487e72e00cace26625fb88e33f83535337a $combinedEanMainWidth = 162.72; $caption($doc, 24, 305, 'CELL ean13-ean2-combined: EAN-13+EAN-2 / version=n/a / ECC=mod-10+parity / payload=9501101530003+12'); $doc->write1DBarcodeWithOptions( '9501101530003', BarcodeType::EAN13, symbolOptions: new Ean13Options(addOn: '12'), x: 32, y: 330, w: $combinedEanMainWidth, h: 68.55, ); $caption($doc, 474, 305, 'CELL ean13-ean5-combined: EAN-13+EAN-5 / version=n/a / ECC=mod-10+checksum / payload=9501101530003+51234'); $doc->write1DBarcodeWithOptions( '9501101530003', BarcodeType::EAN13, symbolOptions: new Ean13Options(addOn: '51234'), x: 482, y: 330, w: $combinedEanMainWidth, h: 68.55, ); $output = \getenv('NEXTPDF_SAMPLE_OUTPUT') ?: __DIR__ . '/../output/42-barcode-1d.pdf'; $doc->save($output); echo "Created: {$output}\n";