dLSoft  barcode & labelling software     

Barcode Libraries

dBarcode DLLs  - includes 32 bit, 64 bit, Ansi and Unicode bit DLLs

The dBarcode DLL products consist of DLL designed primarily for use in C/C++ developement and include both Unicode and ANSI libraries in both 32 and 64 bit variants. The products include sample C++ projects suitable for Visual Studio 2005 - 2017. The 32 bit DLLs are also suitable for legacy systems such as Visual Basic 6. 
Each package also includes a Delphi component (derived from TImage).

Each unit enables the developer to set the code, code type, size, orientation, background and foreground colours, and (for 1D barcodes) human readable font details, text justification, and to enable or disable text characters all from within their application.

Each unit generates both a pattern string for bars and spaces and a metafile picture containing the barcode image and (where enabled) the code text. The picture may be displayed, printed, saved or passed to the clipboard by the user’s code.

Follow the link for more details about generating barcodes in C/C++. Sample Visual Studio projects are included in the product downloads.

Source code for demonstration applications included. - see sample
For more details see the full HELP system or manual.

barcode options dialog with dBarcode dll    
C++ project calling Popup dialog
Screen shot


The dBarcode DLL product range includes a Universal product, which may be licenced for 1D, 2D or both barcodes, and several other libraries that support specific barcode types.

To download a TestWare version now or buy from the online store select the required product below. Licence covers both 32 and 64 bit versions



dBarcode DLL Universal

includes most 1D and 2D types*.

dBarcode DLL – Composite

GS1 Composite barcodes **

or for limited barcode type support:

dBarcode DLL – Standard

Code 39, Extended 39, Code 93, Extended 93, Code 128, Interleaved 2 of 5 and Matrix 2 of 5

dBarcode DLL – GS1

EAN-13/8, UPC-A/-E (with supplementaries), EAN/UCC 14, GS1-128, ITF and SSCC

dBarcode DLL – Aztec


dBarcode DLL – DataMatrix

DataMatrix (including DMRE)

dBarcode DLL – PDF417

PDF417, Truncated PDF417 & MicroPDF

dBarcode DLL – QRCode

QR Code & Micro QR Code

dBarcode DLL – Databar

GS1-DataBar (formerly RSS)


For full details view the product Help file or manual

*dBarcode DLL - Universal (1D and Dual licences) supports the following 1D barcode types: 2 of 5, 3 of 9, Australia Post, Codabar, Code 11, Code 39, Extended Code 39, Code 93, Extended Code 93, Code 128, Code B, Deutschen Post, DUN14, EAN- 8, EAN-13, EAN-14, EAN-128/UCC-128, ISBN, ISMN, ISSN, IATA 2 of 5, ITF-14, ITF-6, Interleaved 2 of 5, InfoMail, Intelligent Mail (OneCode), Intelligent Mail Package Barcode, Italian Post 2/5, Italian Post 3/9, Japan Post, JAN, Korean Postal Authority, Matrix 2 of 5, MSI (Modified Plessey), Planet, Plessey, PostNet & FIM, Royal Mail 4 State, SSCC, SICI/SISAC, Swiss Post, Telepen (numeric and ASCII), UCC-14, UPC-A, UPC-E.

dBarcode DLL - Universal (2D and Dual licences) supports Aztec, DataMatrix (including DMRE), Maxicode, PDF417,Truncated PDF417, MicroPDF, QR Code, Micro QR and GS1-DataBar (RSS).

** Composite product does not generate vector EPS files.

System Requirements

Windows Vista/Windows 7/8/10 or Windows 2008 Server or later. The 32 bit DLL may be used on 32 or 64 bit systems. The 64 bit DLL is suitable only for 64 bit systems.
Development environment using a language capable of making DLL calls, including Visual Studio 2008 - 2017.


Each dLSoft dBarcode DLL may licensed as a single computer product or as a developer version which permits Royalty-free distribution of the DLL as part of the developer's own project for up to 10,000 distributions. Licences cover both 32 bit and 64 bit versions.

Using the dBarcode DLL

Probably the most import matter to resolve before using the DLL is what type of image is to be created.
We always recommend that barcode images are created as metafile images or enhanced metafile images as these have the highest possible resolution. Using the library calls BarDraw, BarDrawEnh or BarDrawBitmap will allow the barcode images to be drawn directly to a device in the position required. For example:

trect.left=12000; // HIMETRIC units
i=BarDraw(hdc, (LPRECT)&trect,(LPBAR)bc, (LPLOGFONT)lfont);
if (theApp.bc.error>0)
goto done;

Similarly a barcode image may be saved directly to a disk file in a specified graphics form using the BarSavemage function, which allows vector images or specified resolution bitmap images to be created, eg:

ires=300; // desired image resolution
if (i!=0)
    BarSaveImage((LPBAR)&theApp.bc, &theApp.lf,(LPTSTR)szFileName, ires);

Some developers may prefer (or be forced) to obtain the images from the clipboard (using BarCodec) or from a disk file. Others may be unable to use metafile images and be forced to use either monochrome bitmaps or device independent bitmaps, at the current a specified resolution. The dBarcode DLLs can handle all these scenarios.

Library calls are formed into two Groups. Group 1 calls to the DLL require a Barcode structure to be filled prior to the call. Group 2 calls do not require the Barcode structure (unless a structure is being retrieved from the dialog box), but do require a dialog box to be used to set barcode properties (as shown in the image above).

Visual Basic programmers should note that some of the elements of the structure are character arrays, and that when these are defined in VB as BYTE arrays, four characters are lost through the VB array header, as shown in the VB declaration below.

Finally it must be emphasised that barcodes created with the kit should be tested before being used. The thickness of lines is an essential element in the readability of barcode images, and while the DLL attempts to produce the correct line thickness, what actually appears on paper is also significantly influenced by the printer technology being used.

The Composite library

The library calls for the GS1 Composite library are analogous to those for the dBarcode DLLs, except that all calls that supply a data string have been modified to supply two data strings – one for the Linear portion of the barcode and one for the Composite Component of the symbol.

The size of symbols generated by the composite library is determined entirely by three members of the BARCOMP structure:
xunit – this is the width (in Mils – 1/1000 inches) of the thinnest element of the symbol.
ymult – this is the value by which xunit is multiplied to generate the height of each element of the composite component.
linheight – this is the height of linear bars in Windows HIMETRIC units (0.01 mm). The barcode properties dialog allows this value to be provided in Inches or Millimetres.
For Databar Stacked and Truncated types there are height values specified by the GS1 Databar standard and these override any value provided through the linheight parameter.

The size of the symbol created is returned in the length and height members of the BARCOMP structure in Windows HIMETRIC (0.01 mm) units.

Delphi components

The dBarcode for Delphi Components are wrappers for the dBarcode DLLs, and create TPicture images containing a barcode and (optionally) the text version of the code underneath the bars. The metafile picture may be viewed, printed, saved to disk or copied to the clipboard through the users own program.

The barcode component is based on the TImage and so inherits many of its properties from this object. Over and above this, the component supports properties specific to its application, in this case the production of Barcodes. The component can be placed on a form and its properties set a Design time or altered through code at Run-Time.
A sample application is included in the form of the dBarcode1 project, which includes the UNIT1.PAS source file.

A typical example is shown below

procedure TForm1.DoBarcode();

Printing the barcode

To print a barcode image one approach is to Draw the Picture on the Printer.Canvas, as shown in the code sample below.
Note that the Picture is created in HIMETRIC units, and so to print the image at the correct size these must be converted into printer pixel units using the GetDeviceCaps() function.

procedure TForm1.Button2Click(Sender: TObject);
ii: integer;
jj: integer;
Rect: TRect;
pScalex: Integer;
pScaley: integer;
DoBarcode(); {recreate the barcode image}
{set the target rectangle for drawing on the printer}
{change from mm to pixels}
ii:=(Barcode1.ImageWidth*pScalex) div 2540;
jj:=(Barcode1.ImageHeight*pScaley) div 2540;
Printer.Canvas.StretchDraw(Rect, Barcode1.Picture.Graphic);