Streaming Barcode Images into SAP Crystal Reports
Barcodes may be easily placed in SAP Crystal Reports versions 11 (XI) and above (including SAP Crystal Reports for Enterprise) with IDAutomation's Dynamic Barcode Generator Service. When using this service to stream barcodes into reports, there are no additional products to install. The only requirement is that all machines generating reports need access to the Internet or the server generating the barcodes, which may be installed on an Intranet or the report generator itself.
Multiple barcode symbologies are provided by the service, including Code 128, Code 39, GS1 DataBar, USPS Intelligent Mail IMb, UPC, Data Matrix, PDF417, QR-Code, GS1 QR-Code, GS1 Digital Link and more.
Crystal Reports Windows Version Tutorial
- Download the Crystal Reports QR Code Streaming Example and extract the files.
- Open the IDAutomation_CrystalReportsStreamingExample.rpt file in Crystal Reports 11 or greater. This example displays a QR Code with the free demo version of the IDAutomation Dynamic Barcode Generator Service which contains a watermark in the barcode. The licensed version does not contain the watermark.
- Choose View - Preview and verify that a QR Code Symbol appears.
- Right-click on the symbol, choose Copy, and paste it into the report that needs the barcode.
- In the report, Right-click on the symbol and choose Format Graphic.
- When the dialog opens, choose Picture - Graphic Location to open the formula workshop.
- In the Formula Workshop, modify the DataToEncode, CustomParameters, and CustomURL as necessary:
Modify the DataToEncode to include the data that needs to be encoded in the barcode symbol, for example:
DataToEncode = ({TestData.DataField})
Text or function may be included in the data to encode and multiple fields may be combined with the & symbol. In the example below, ~d009 performs a tab function in QR Code between two fields in a QR Code:
DataToEncode = ({Table.Field1})&"~d009"&({Table.Field2})
If an error such as "A string is required" appears, the data will need to be converted to a string with a visual basic crystal function. For example: DataToEncode = cStr( {Table1.FloatValueField},0 )
Modify CustomParameters with parameters if necessary. The parameters must be separated by the & character and cannot include any spaces.
Modify the CustomURL with the URL provided when you purchased the Dynamic Barcode Generator Service. The demo version URLs may be used for testing. As per SAP documentation, Crystal Reports cannot display an image from a secure URL with https, therefore make sure you change https to http in the CustomURL. - Choose the options to save and close the Formula Workshop and return to the preview. If the barcode symbols do not appear as expected, use the example provided to perform a process of elimination to find the issue.
Enterprise Tutorial for Enterprise Versions or if the above does not work
- In the report, choose Insert >
OLE Object. Enterprise users select Insert >
Picture.
- Select Bitmap Image from the dialogue box and click
OK.
If the "Bitmap Image" option does not appear, such as if in SAP Crystal Reports 2013 or Enterprise user:
(1) Right-click and save this crystal-barcode-image.jpg file or another small jpeg image to the hard drive as the default image to show. This image will also show if the barcode cannot be generated.
(2) Repeat Step-1 and choose Create from File.
(3) Select the crystal-barcode-image.jpg file saved from above.
- Position the object in the report. (NOTE:
When the object is dropped onto the report designer, the object may
be in Edit Mode. Simply click off of the object to return to
Design Mode.)
- Select the object and click on Format Graphic from
the file menu. Enterprise users right-click on the image and select Format
Graphic.
- On the Common tab, ensure the "Can Grow" option is enabled
with a checkmark in the box as shown below:
- On the Picture tab, ensure the Scaling Width and Height are at 100%, and
then click on the Graphic
Location formula icon as shown below:
- In the Formula Window that appears, enter the
streaming barcode service URL
and append the appropriate parameters to ensure the JPEG file type is
created, including the field that needs to be encoded and any other necessary
parameters. As per SAP documentation, Crystal Reports cannot display an image from a secure URL with https it requires http.
"http://www.bcgen.com/demo/linear-dbgs.aspx?I=JPEG&D="+{TestData.Data}
- Save and Close the Format Function window. The Print Preview feature will
reveal the barcode streamed into the report. If the barcode does not appear,
ensure the URL is correct (step 7 above) and ensure the PC running the report
has access to the Internet.
- If problems are encountered, try the example download.
When streaming barcodes on very large reports, latency may cause a slight
slow-down in report generation. If the issue is still experienced, consider
implementing one of the products listed below on your intranet, or on the report
generator itself to reduce
latency:
- ASPX Barcode Generation Script
- Java Barcode Servlet
- PHP Barcode Generation Script
- Streaming Barcode Server for IIS
Additionally, many other Crystal Barcode Integration options are available that do not have latency issues.