Setting Up Label and Barcode Printing in 1C-Bitrix

Manual labeling of goods with labels and barcodes often leads to errors: mixed-up SKUs, incorrect codes, inconsistent formats. We automate label and barcode printing directly from 1C-Bitrix, eliminating human error and speeding up warehouse operations. Our team delivers a turnkey project — from setting up code generation to integration with printers, ensuring stable operation and ongoing support.

Our competencies:

Frequently Asked Questions

When accepting goods at a warehouse, a problem often arises: each item needs to be labeled with a barcode sticker. Doing this manually leads to errors: a mixed-up SKU, an incorrect barcode, an inconsistent format. With a volume of 200 items per day, errors are inevitable.

We automate the printing of labels and barcodes directly from 1C-Bitrix: from storing codes to sending them to the printer. In this article, we'll explain how to set up such a system, what tools we use, and how it speeds up warehouse operations.

The average savings on materials and time amount to cost calculated after audit per year (based on our project data). In addition, automation eliminates reprinting and reduces the number of returns.

Why is label printing automation critical for a warehouse?

Manual label preparation leads to errors: a mixed-up SKU, an incorrect barcode, inconsistent formatting. At volumes of 100 items per day or more, this becomes critical. Automation eliminates the human factor and speeds up the process by 5–10 times.

In addition, product labeling is a requirement of many retail chains and marketplaces. Without a barcode, goods will not be accepted for sale. That is why automation is not a whim, but a necessity.

How we store and generate barcodes in Bitrix

Barcodes are stored in the b_catalog_product_barcode table: PRODUCT_ID, BARCODE, TYPE (EAN-13, Code128, QR, etc.). A single product can have multiple barcodes.

Retrieving product barcodes:

$barcodes = \Bitrix\Catalog\ProductBarcodeTable::getList([
    'filter' => ['PRODUCT_ID' => $productId],
    'select' => ['BARCODE', 'TYPE'],
])->fetchAll();

If a barcode is missing, we generate it algorithmically. For example, EAN-13 based on the product ID with a check digit:

function generateEan13FromId(int $productId): string {
    $code = str_pad($productId, 12, '0', STR_PAD_LEFT);
    $sum = 0;
    for ($i = 0; $i < 12; $i++) {
        $sum += (int)$code[$i] * ($i % 2 === 0 ? 1 : 3);
    }
    $checkDigit = (10 - ($sum % 10)) % 10;
    return $code . $checkDigit;
}

After generation, the barcode is saved to b_catalog_product_barcode. You can also use HL blocks for custom fields if you need to store additional data, such as expiration date or weight.

Barcode image generation

To generate images, we use proven PHP libraries. Most often we use php-barcode-generator. Installation via Composer — composer require picqer/php-barcode-generator.

Generating EAN-13 in SVG for printing:

$generator = new \Picqer\Barcode\BarcodeGeneratorSVG();
$svg = $generator->getBarcode('4607134392015', $generator::TYPE_EAN_13, 3, 60);

SVG is preferable to PNG — it scales without quality loss at any DPI.

Label Template

A label is assembled as an HTML page with @media print and sent to print via a browser or converted to PDF. Minimal template 58×40 mm:

<!DOCTYPE html>
<html>
<head>
<style>
@page {
    size: 58mm 40mm;
    margin: 2mm;
}
body {
    font-family: Arial;
    font-size: 8pt;
}
.label {
    width: 54mm;
    height: 36mm;
    display: flex;
    flex-direction: column;
}
.barcode {
    text-align: center;
}
.name {
    font-size: 7pt;
    overflow: hidden;
    max-height: 12mm;
}
.price {
    font-size: 14pt;
    font-weight: bold;
    text-align: right;
}
</style>
</head>
<body>
<div class="label">
    <div class="name"><?= htmlspecialchars($product['NAME']) ?></div>
    <div class="price"><?= $price ?> rub.</div>
    <div class="barcode"><?= $svg ?></div>
    <div style="text-align:center; font-size:7pt"><?= $barcode ?></div>
</div>
</body>
</html>

The 58×40 mm size is the standard for Zebra/Godex label printers.

Comparison of Printing Methods: HTML vs ZPL

Parameter HTML + @media print Direct ZPL sending
Print quality Depends on the printer driver Optimized for thermal printers
Batch printing speed Low (each page OK) High (command batch)
Design flexibility High (CSS) Medium (ZPL commands)
Printer support Any (with a driver) Only ZPL-compatible

For 1–10 labels, HTML printing via a browser will do. For 100+ labels, direct ZPL sending to the printer (socket on port 9100) reduces time significantly.

How to set up batch printing via the administrative interface?

In the Bitrix administrative interface, you can display a list of products, select the ones you need, and start batch printing. We implement a button that collects all labels into a single PDF or sends a ZPL package to the printer.

For A4, we create a grid layout with break-inside: avoid. We embed a custom page in /bitrix/admin/. It accepts PRODUCT_ID[] via GET (from the product list via mass actions), renders the labels, and calls window.print().

How to set up direct printing to a printer

For Zebra and similar:

$socket = fsockopen('192.168.1.100',по индивидуальному расчётуerrno, $errstr, 5);
if ($socket) {
    $zpl = buildZplLabel($product, $barcode);
    fwrite($socket, $zpl);
    fclose($socket);
}

This works without a browser window and is faster for large volumes.

Example configuration for Zebra GK420d
^XA ^FO50,50^A0N,30,30^FDMyLabel^FS ^FO50,100^BY2^B3N,N,100,Y,N^FD1234567890128^FS ^XZ

Comparison of Barcode Types

Type Application Length Features
EAN-13 Retail 13 digits Standard for most retail chains
Code128 Logistics, box labeling Variable High encoding density
QR Labeling, links to additional information Up to 177×177 Can contain a URL

What is included in our work

  • Analysis of the current labeling process and label requirements.
  • Designing the barcode storage structure in information blocks and HL blocks.
  • Development of a barcode generation component (EAN-13, Code128, QR).
  • Creation of label templates for your equipment (Zebra, Godex, Citizen).
  • Configuration of the administrative printing interface (one at a time or in batches).
  • Integration with standard printers (via ZPL/EPL or browser).
  • Testing and debugging on your test warehouse.
  • Documentation and employee training (2-hour online call).
  • 6-month warranty on the developed module.

Our team consists of experienced Bitrix developers with 10+ years of experience and more than 50 warehouse automation projects. Contact us to discuss your task. Get a consultation on automating printing at your warehouse. Our engineers will assess current processes and propose a solution for your budget.