Module Barcode

Numero/ID of module 55
User doc. of module This page
Developer doc. of module Module Barcode (developer)


The bar code module allows you to add bar codes where it can be usefull (like on products cards or third parties).


This module is included with the Dolibarr distribution, so there is no need to install it.


To use this module, you must first enable it using an administrator account, via the menu option "Home - Setup - Modules".

Choose the tab where the module is listed. Then click on "Activate".

The module is now activated.

If a cog icon appears   at end of line of the module, click on it to access the setup page specific to the module.

Barcode encoding type

On the setup page, you choose for each barcode format you want to support, the engine that will build the graphical output (image) of bar code.

The engines available by default and supported by Dolibarr developers are the Dolibarr internal engine based on php-barcode and TCPDF-barcode which makes use of the barcode generator available in the TCPDF library.

Eventually, you can install the program genbarcode ( to have more format supported by this engine. Sources for the command line genbarcode program is also available here: File:Genbarcode-0.4.tar.gz

You can also install new barcode generator engines (see in download area of to support more format.

Other options

Then, always on module setup page, choose which feature you want to enhance with barcodes:

  • Products management
  • Third parties management

Manager to auto define barcode numbers (Product)

Enable numbering module you want to use for suggesting and validating barcode number for products. Define also mask to make the automatic numbering generation working.

For example, if you choosed to use the EAN format ( ) for products in previous setup, you can enter the value:

  • Where 300 is the country number (See
  • 999 is the Company number (according to country it may have more digits). To get a number for your company, you must contact the GS1 for your country:
  • {000000} is the product number. You decide this number. It is counter with maximum 6 digits (according to country it may have less digits). Length is (8 - number of digits for your company number).
  • Checksum digit is not required for EAN13 (it is added automatically)

Note: A barcode EAN13 identify in most cases a product (as a template), like do the reference of a product (also called Part number). Identification of the serial or lot can be done with the Serial No also called SSN, S/N, or SN or the Product No. Serial and Product are sometimes an autonomous bar code number, sometimes included into a EAN128 code: A serial may be a lot or a unique instance of a product (that is a lot of 1).

Note: The SKU is a generic term to say: "The ID enough accurate to manage stock". So SKU depends if you use lot or not. It can be a Part number or a Serial No. Best thing is to avoid using this term to avoid confusion.


Once the setup step is finished, you will see a new field "bar code" on some screens, depending on what you choosed for features to enhance (third party screen and/or product screen). You can then enter barcode values in such fields, using keyboard or barcode scanner:

Using keyboard

Just enter the number represented into the barcode. This suppose that number was printed under barcode graphic. This will be the case if you print the barcode stickker using the "'Print barcode'" feature provided with Dolibarr 3.6+ (menu Tools).

Using barcode scanner

If barcode number is not visible, or if you don't want to loose time typing all numbers, you can use a hardware barcode scanner. To be compatible with Dolibarr, your barcode scanner must support the "keyboard emulation": When you scan the barcode, it is like when typing the number from the keyboard. To find a barcode scanner supporting such emulation, you must have a look a technical specification of barcode. Scanner must provide the term:

  • "HID" mode (for Human Interface Device)


  • "Keyboard Wedge" or "Wedge" interface

More information on page:

You can find bar code reader to read barcode EAN13 (13 numbers) and others to read barcode code-39 (numeric, unlimited number of characters) or barcode code-128 (alphabet, unlimited number of characters). Most barcode scanner read all formats.

  • EAN13 is used to define a product.
  • code-39 is used for stock tracking (serial number with numeric character only).
  • code-128 is used for stock tracking (serial number with numeric and alpha character).

To test your scanner can read code-128, you can use this page (print it before, most scanner don't work when used directly on computer screen display):


  • MOTOROla DS4208
  • Datalogic QW2120
  • EAN: 6913280798816

This is another example tested successfuly on a Linux Ubuntu:

  • Just plug the USB cable of scanner into your computer, then you need to scan the barcode on provided manuel to set the correct keyboard. Once done, every scan will be output as if you use the keyboard.