PRB: Defect DataMatrix Printed with Crystal Reports RAS Engine

SYMPTOM

When printed using Crystal Reports RAS engine, some datamatrix barcodes contains defects, which cause the barcode unreadable. This behavior does not appear in print results produced using Crystal Reports Print Engine.

Crytal Reports contains two print engines: Crystal Reports Print Engine (CRPE) and Reporting Application Server (RAS). Although developers may not know it, the two has different implementation. CRPE is the oldest and reliable method that is used in Crystal Reports Designer and Viewer.

The .net code illustrates the use of RAS as print engine:

 String reportPath = @"test.rpt";
  _report.Load(reportPath);
  
  PrinterSettings printer = new PrinterSettings() { PrinterName = @"HPLaserJ"; };
  PrintOutputController rasPrintOutputController;
  rasPrintOutputController = _reportClientDocument.PrintOutputController;
  PrintReportOptions printreportoptions = new PrintReportOptions();
  
  printreportoptions.PrinterName = @"HPLaserJ";
  printreportoptions.NumberOfCopies = 1;
  rasPrintOutputController.PrintReport(printreportoptions);

Figure 1. Defect DataMatrix Barcode

Defect DataMatrix Barcode

CAUSE

The Crytal Reports RAS engine contains bugs in its font render that produces incorrect widths under certain conditions. To work around the issue the character mappings of the font must be changed.

RESOLUTION

Upgrade to DataMatrix Fonts & Encoder 5.2 (released in May 2017) or above . Replace encoder function DataMatrixEncodeSet with DataMatrixEncodeSetRAS in your formula definition, then refresh the report.