How to Create, Print and Export Barcodes in .NET/C#

With List & Label, our reporting component for software development, you can use barcodes in numerous formats in .NET/C#. The portfolio of barcodes is constantly expanding.

Integrate a Barcode Generator into Your Application

Barcodes are machine-readable symbols used in many processes across a wide range of industries for quick identification. First used primarily in the manufacturing industry, barcodes are now present in many ways in everyday life. For example, when scanning goods at the supermarket checkout or franking postal items. As the range of uses has increased, so have the variants of barcodes. Barcodes are divided into different types such as barcodes or 2D codes and have names like Code128, QR-Code, PDF417, Datamatrix or EAN-13.

If your software needs a barcode generator like List & Label for one of the reasons mentioned above, an integration can be reasonable.

Supported Barcode Formats

List & Label belongs to the leading reporting tools with a wide range of different barcode formats for any solutions and requirements. Just to name a few:

  • 2-of-5 family
  • Aztec
  • Code39 family
  • Codablock F
  • Datamatrix
  • EAN family (EAN8, EAN13, EAN14, EAN128)
  • EPC/Girocode
  • GS1 family
  • Maxicode
  • FIM
  • ISBN
  • Premiumadress
  • PDF417 + MicroPDF417
  • Pharmacode
  • QR-Code
  • Royal Mail
  • and many more

A list of all supported barcode formats can be found in the overviews for General 1D CodesPostcodes (1D and 2D Codes) and General 2D Codes. But how can these barcodes be created with List & Label and which requirements are necessary?

Prerequisites for List & Label Barcodes

In order to use the barcodes, List & Label must be integrated as a component in your own application. The .NET Tutorial shows how fast and easy this can be done. Then call the integrated List & Label Report Designer using the Design() method to create your own template for a report with barcodes.

No special barcode font needs to be purchased for any barcode and there are no runtime fees. List & Label draws the barcodes completely by itself according to the respective standard. We have verified the quality and conformity of the barcodes through a cooperation with REA, a renowned vendor of barcode verifiers.

Specialized in Print Optimization

One feature that clearly sets List & Label apart from other products is the optional print optimization for optimal barcode pixel alignment. This ensures that when printing on a physical printer, the quality of the barcode is adjusted depending on the output device pixels. This avoids rounding errors and ensures readability.

Note: List & Label is offered in different editions for varying requirements, 2D barcodes are included from the Professional Edition.

Create and Define Barcodes

But how can the barcodes now be created with List & Label – both interactively through the Report Designer or even controlled through the source code?

In the Report Designer

The easiest way to create any barcode is directly in the Designer. Here there is the barcode object that can be easily inserted from the ribbon:

using a static text to create barcodes

Barcode in Report Designer: use as static text

For the Text option, you then simply select the desired content for the barcode to be encoded. However, its formatting depends on the selected barcode (here: QR code). Thus, fixed or static texts could be used as barcodes. But for more dynamics and flexibility and also depending on the declared data source in List & Label, a formula can also be determined using the designer function Barcode() to define the content of a barcode and its type:

use a formula to create a barcode

Barcode in Report Designer: use as formula

In the Source Code (with .NET Component in C#)

The Report Designer is used here as well. Directly from the registered data source it is specified that the data should be registered predefined as a certain barcode type. This way, users do not have to take care of formatting the barcode themselves. The process can be specified by the application itself in the source code and significantly reduces the complexity from later end users. For this purpose, the class LlBarcode is available when programming in C#, whose properties determine the Content and the Type of the barcode. Example:

LlBarcode myBarcode = new LlBarcode("EXPSA01", LlBarcodeType.EAN128);
LL.Variables.Add("Artikel.Nr_EAN128", myBarcode);

In the Designer itself, users only see that a barcode variable with the name Item.No_EAN128 is available. This can now be easily placed in the report via drag & drop:

use a variable to create a barcode

Barcode in the report designer: use as variable

Tip: Using the data binding events AutoDefineField/AutoDefineVariable the field/variable types can also be easily changed at runtime in your own program code. Example:

LL.AutoDefineVariable += LL_AutoDefineVariable;
private void LL_AutoDefineVariable(object sender, AutoDefineElementEventArgs e)
    if(e.Name == "Artikel.Nr_EAN128")
        e.FieldType = LlFieldType.Barcode_EAN128;

In the Source Code via DOM API without Designer (with .NET Component in C#)

List &List & Label offers another elegant way to create and modify a report: With the so-called Document Object Model (DOM) API, a report can be created completely in source code. This way it is also possible to modify existing reports. With the help of the class ObjectBarcode 1 via the AddNewBarcode() method, barcodes are simply added without the Report Designer becoming visible even once. Example:

private void GenerateBarcodeObject()
        // Create new DOM project, type LlProject.List
        using (ProjectList proj = new ProjectList(LL))
            // Set file name and file access options
            proj.Open(Path.Combine(Application.StartupPath, "dynamic.lst"), LlDomFileMode.Create, LlDomAccessMode.ReadWrite);
            // Get the coordinates for the first page
            Size pageExtend = proj.Regions[0].Paper.Extent.Get();
            // Add a barcode object
            ObjectBarcode llobjBarcode = proj.Objects.AddNewBarcode();
            llobjBarcode.Source.BarcodeType = LlBarcodeType.EAN128;
            llobjBarcode.Source.Text = "EXPSA01";
            llobjBarcode.WithText = "true";
            llobjBarcode.Position.Set(pageExtend.Width - 50000, 10000, pageExtend.Width - (pageExtend.Width - 40000), 27000);
    catch (ListLabelException LlException)
        // Catch Exceptions
        MessageBox.Show("Information: " + LlException.Message + "\n\nThis information was generated by a List & Label custom exception.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

Print or Export Barcodes

Once the report is created using the Report Designer or DOM API, another strength of List & Label comes into play – the numerous export options. The report with the barcodes can be output in many ways:

  • classically to any printer
  • in document formats such as PDF, Word (DOCX), Excel (XLSX) etc.
  • in graphic formats for easy further processing like PNG, SVG, JPEG etc.
output options for barcodes

Output setting: Format selection in List & Label

Printing or exporting is performed and controlled from your own application using the List & Label component in the source code via the Print() and Export() methods. This is thoroughly explained in the .NET Tutorial in the chapter Design, Print and Export.

Tip: For image export formats like PNG or JPEG, the helpful Export Options Picture.CropFile and Picture.CropFrameWidth are available to remove an unnecessary white frame from labels/barcodes.

Examples of Special Barcodes in List & Label

List & Label offers a wide range of different barcodes that can be used for various requirements in any field of application, such as payment transactions, shipping (via forwarding agents), processes in the medical/pharmaceutical sector, as ISBN in publishing, and many more.

Swiss QR Code

In swiss payment transactions, the so-called Swiss QR code is required, which must have the Swiss cross in the middle. The article Print Swiss QR Invoice with List & Label contains a sample report for the Report Designer for this purpose and is based on a typical sample invoice.

example for swiss qr code

QR code with Swiss cross

Instead of the Swiss cross in the abovementioned Swiss QR code, it is also possible to place your own company or product logo in the QR code. This way, the corporate identity, for example on letter paper, can be shown to even better advantage.

example for product logo qr code

QR code with product logo

EPC QR Codes for SEPA Credit Transfers

In the international payment traffic, QR codes can also be created for SEPA transfers, which is exemplified in the article Creating EPC Barcodes with List & Label.

Feel free to leave us a comment if you have implemented other interesting or special requirements with List & Label in the barcode area.

Test Barcodes with the Trial

To quickly get an idea of List & Label’s barcode capabilities download our free List & Label Trial.

Related Posts

Leave a Comment