xtrareports-117849-feature-guide-to-devexpress-reports-use-report-controls-use-bar-codes-bar-code-recognition-specifics.md
This document describes the main specifics of barcode recognition and how to resolve the most frequently encountered issues when working with bar codes.
The bar code type (symbology) depends on your specific business requirements and the applied industrial standards.
In general, we recommend that you consider using Bar Code 2 of 5 Interleaved for encoding digits and Bar Code 39 for encoding the full range of ASCII characters.
Some encodings enable you to insert a special FNC1 character for separating application identifiers from the rest of the barcode.
According to the GS1 specification, the FNC1 character is always inserted at the first position of the encoded data. Other identifiers can be inserted manually with the default “ # “ character.
Although you can use any ASCII character as the FNC1 placeholder, it will not be a part of the encoded data as it does not have any direct ASCII representation.
For the Code 128 symbology, you can also define FNC2-4 characters.
For the list of the available application identifiers, refer to the official documentation at www.gs1.org.
At present, only export to PDF preserves the original barcode in its vector form. Export to other formats will keep only the rasterized version of a barcode (with the default DPI set to 96 ).
For XLSX and XLS export, the output resolution can be set up manually using the PageByPageExportOptionsBase.RasterizationResolution property.
The TargetDeviceDpi property allows you to specify the DPI of the device on which you wish to print your barcode. The XRBarCode automatically adjusts bar density based on this property’s value.
Use the TargetDeviceDpi property to ensure that the bar code is scanned correctly on the target device. This is especially important if your printing device has a non-standard DPI setting.
DevExpress Reporting is built on top of the .NET Framework, which does not provide out-of-the-box support for any matrix and thermal printers.
To access the internal printer fonts or achieve the fastest printing speed possible, use the native approach suggested by the printer manufacturer. Typically, a manufacturer would provide a special series of control commands that should be directly sent to a printer’s port. In some cases, the printer may also come with a proprietary graphical Report Designer.
After specifying barcode settings, you can make sure that the resulting barcode will be properly rendered in a document by calling the Validate method of a corresponding class:
When validation fails (indicating that the barcode is not rendered), the control displays an error message corresponding to one of the PreviewStringId enumeration values.
This section includes solutions to the most common issues that you may encounter during bar code creation.
The barcode is too “dense”
The barcode is correctly displayed on the preview page but it is not scanned
The barcode is correctly displayed on the preview page but it is scanned incorrectly
The “There are invalid characters in the text” error occurs