Quantcast
Channel: { Name: "Mazin" }
Viewing all articles
Browse latest Browse all 25

QR or Barcodes in iScala Crystal Reports

$
0
0
We use Crystal Reports to accommodate our custom reporting requirements (layout and informationfor iScala ERP 2.3. The Crystal Reports run in the context of the database of the company to which the user is logged in when the report is invoked by the user. 

I should blog more about my iScala experiments, especially when there doesn't seem much talk about it around the developer blogsphere. I will update here when/if I do so. But here is my latest adventure: 

We have a project through which we want to improve our digital experience. This means that we needed to place a scannable barcode (or some other standard symbology (a symbological system)) on one of our reports. The symbology will correspond to the ID of that report (a PO number for a PO report to be specific).

I quickly came to learn that using barcode fonts (the easiest way to render some barcodes on a Crystal report) are not scannable by standard readers as they do not follow standard conventions and features of the various barcode systems. I came to the conclusion that if it is a font, then it won’t be scannable after trying 3 different barcode fonts of differing symbologies including what looks like PostNet and International Article Number aka. IAN or EAN. 

Example of QR code linking to mazinissa.com


In a sad moment, I downloaded a 3rd party’s software and installed it on a test computer. That added some COM DLLs and provided special functions in Crystal Reports that rendered scannable codes of different formats: QR, bars and others. The DLL was comprehensive and worked well. It still used some special fonts to help with rendering, and the unmanaged COM DLL ordered and laid out the text in the correct way. The font consisted of several components that could be composed to render a valid barcode image and it can't be used independent of the 3rd party library. 

We have three issues here: 
  1. We're downloading a 3rd party's components to our server which introduces security and reliability questions. 
  1. The 3rd party component's are not free (free demo version available). 
  1. Just downloading a library that does everything for you is not the most fun way to "develop" solutions. 

So I thought of a couple of alternatives of which only one worked: 
The first option was to Create a web service on one of our servers that would serve a corresponding barcode image depending on a query string parameter sent to it via HTTP GETI can construct a URL for an image depending on a record values in Crystal Reports. A picture object in Crystal Reports can have the "Graphic Location" set as a formula. The web service would still rely on an open source library to do the actual image generation as studying barcode specifications is outside the scope of generating a report with a barcode.

Right click a picture object and choose Format Object. Under the picture tab you can find the graphic location formula.

This would require a deployment of a LIVE web application. This is a big deal in a bureaucratic environment, but I didn't push for it anyways because even though I was able to generate a URL for the image’s source, Crystal Reports failed to actually GET from the web resource. The image URL works with local resources such as a path on the same computer (not sure of a network path). This might be a security configuration issue, but I didn't explore in that direction further. 

The second option was to see if I can directly use that open source barcode library from SQL Server and not through a web service: enter CLR Stored Procedures. This how I came to write my first CLR Stored Proc and that was an adventure by itself. 

Viewing all articles
Browse latest Browse all 25

Trending Articles