KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Note: Printing Barcodes using 4D v11 SQL and SVG
PRODUCT: 4D | VERSION: 11.2 | PLATFORM: Mac & Win
Published On: July 30, 2008

This Technical Note updates Technical Note 05-08 for 4D v11 SQL. Using the new SVG features of 4D v11 SQL to replace 4D Chart to create bar codes, the result is much faster creation with higher quality. It also fixes a bug.

See the original Technical Note for a description of the commands and features (included with this document and also available at):

Printing Barcodes Tech Note

Download Complete Tech Note and Example: Windows | Mac

Commented by David Nasralla on November 6, 2015 at 12:33 PM
I have not been able to render the barcodes with PRINT LABEL in v15 after upgrading from 13.6. (It appears as a black box.) My work around is to convert the image to a jpeg with CONVERT PICTURE (picturevar;".JPG";0.9)
Commented by Anastasia Koutsou on March 28, 2015 at 7:57 AM
There is a problem if BarCode_SetParams is called: Barcode_Width remains undefined, while I think it should be set to 1. If a barcode with default settings is created first, then there is no problem
Commented by Thomas Maul on April 29, 2014 at 3:16 AM
The Tech Note component has an error creating for Code128C the correct checksum in some cases (big thanks to Rudy Mortier for finding, reporting AND fixing). Update published on https://github.com/ThomasMaul/Barcode_SVG (as v13 structure)
Commented by Add Komoncharoensiri on February 15, 2011 at 10:23 AM
The Labeleditor of v11/v12 does not support SVG, so you cannot print a SVG image directly in a label. The workaround is to convert the created picture into a bitmap format, like TIFF, then use the TIFF in the label editor. You may want to resize the picture before converting, to get the required resolution/quality. This should solve your issue.
Commented by David Nasralla on February 9, 2011 at 8:24 PM
In Windows, as of v11.8 HF2 and v12.1 HF2, you can not render the barcode in the form event of a Label. The barcodes must be rendered before printing if you are using the label editor. If you do, the barcode will not print correctly (black squares appear across the barcode making it unusable). The Mac side is fine.
Commented by David Nasralla on February 9, 2011 at 8:23 PM
In Windows, as of v11.8 HF2 and v12.1 HF2, you can not render the barcode in the form event of a Label. The barcodes must be rendered before printing if you are using the label editor. If you do, the barcode will not print correctly (black squares appear across the barcode making it unusable). The Mac side is fine.
Commented by David Nasralla on December 2, 2009 at 10:10 AM
If you are upgrading from the previous version, there are a couple of items you should note:

1) The API has changed slightly. Because of the protected variable namespace, you must call Barcode_SetParams to setup the barcode variables. I modified the component to include a sixth parameter to allow me to specify the BarcodeWidth variable. (Otherwise, I really could not figure out how to set the variable - 0 or 1).

2) You must check all of your calls to Barcode_Create and make sure you are not passing a sixth parameter. The new API only has 5 parameters. As of v11.4 the (any) component will fail or crash if you call it with more parameters than it is programmed to receive. I don't know if that bug has been fixed.

3) As of v11.5 you can not print a picture variable on a Label from Windows. Macs work. This is a confirmed bug.