Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2D (Data matrix) PCL

Status
Not open for further replies.

wavp

Programmer
Sep 21, 2008
1
Hi,

I am trying to create a 2D (Data matrix) barcode to a printer using PCL escape code...anyone please have the PCL which will allow me to create a 2D barcode using programming with PCL code?

Many thanks,

Wilhelm
 
If it's going to be the same bar code over and over, then
you could use a graphic program that converts a graphic format to pcl, save it to a file, and use it in your coding.

If you need to change it on the fly, then probably the best way to go would be with a barcode soft font or a plug-in with a barcode font and access it that way.
 
To a PCL printer, a Data Matrix code must be coded as raster graphis. There can not be any "font" to do this as with a barcode, which is, by definition, one-dimensional, since fonts are also one-dimensional.

There are many programs that can convert standard graphics formats to PCL. Can the Data Matrix code be converted to some standard graphics format>
 
Any PCL element in the creation of a Data Matrix bar code will only be the (relatively trivial) final part of the process.

There are two main stages in the creation of most 2-D barcodes, including Data Matrix:

(1) High Level:

(a) Algorithmic determination of the most efficient combination of compaction methods, given the input data.

(b) Conversion of fragments of the input data to intermediate 'code words', this conversion is dependent on the compaction mode most suited to that fragment.

(c) Calculation of the appropriate error correction codewords, given the calculated data codewords, and the specified (or calculated) error correction level.

(d) Addition of any necessary padding codewords, given the set of data and error correction codewords, and the required symbol metrics (width, height, aspect ratio, etc.).


(2) Low Level:

(a) Conversion of individual codewords to bar-space sequences (and their placement in the matrix).

(b) Conversion of those bar-space sequences:

EITHER to a drawing pattern (using raster or vector graphics, as appropriate or desired.

OR to a character selection (perhaps more than 1 mini-character per sequence) using a suitable font.


Any PCL element would be within the (2)(b) part.
Note that if you used a specialised font, a PCL-encapulated variant of this would have to be downloaded to the device, since LaserJet devices don't (to my knowledge) have any suitable printer-resident font available.

Note that it IS possible to use a downloaded font for this purpose:

(1) The font would need to contain various characters which printed different sequences of one-module (or perhaps two) module high bar and space modules.

(2) The bar-space sequences from 2(a) above can be considered as a series of such characters, each one (or two) module(s) high, so the whole barcode (even though it is a 'matrix' code, rather than a 'stacked' code) can still be represented as a series of rows of such font 'mini-characters.
 
I suppose it would be possible to build such a font if you limit yourself to one of the smaller data spaces. I don't think any "font" would be useful for a large data space, however.
 
I can't see that it makes any difference whatsoever whether the bar-space modules are constructed using raster (or vector) graphics, or using a suitable font containing various bar-space module sequence shapes.

By suitable, I'm assuming use of a PCL Encapsulated TrueType Outline (PCLETTO) font, and not (one or more) bitmap fonts.

In the past, I've created a TrueType font (for use with some transform code) for the PDF417 2-D 'stacked' barcode, but the same principles should apply to other 2-D bar codes, like DataMatrix and QRCode.
A PCLETTO font is just a PCL-encapsulated version of such a TrueType font.

I'm not sure what is meant by smaller and large 'data spaces' in this context; is it referring to the different matrix sizes used by Data Matrix, or what?

Where there can be problems (and this applies to the raster method as well) is on low-resolution devices (e.g. 72 dpi screens): if the module size is not chosen appropriately, when it is eventually converted to device pixels, 'rounding' errors can make some bar codes unreadable at certain sizes.

This is not usually a problem on higher resolution (600 dpi and up) devices such as most modern laser printers.
 
The encoding for Data Matrix is different for each data space size (the amount of data that can be coded in the graphic code) Data Matrix is NOT a "bar" code of any kind. For a given data space size, the pixel dimensions are fixed; the data space sizes are not continuous.
 
Data Matrix is one of a group of encoding mechanisms collectively referred to as 2-D bar codes, to distingush them from the more familiar linear 1-D bar codes, such as Code39, Code128, Interleaved 2 of 5, EAN13, etc.

The title of the official specification document (ISO/IEC 16022:2006(E)) for Data Matrix is:
"Information Technology - Automatic identification and data capture techniques - Data Matrix bar code symbology specification"
This title includes the term "bar code".

The Data Matrix symbol may use any of 24 square shapes (from 8x8 modules, up to 132x132 modules), or 6 rectangular shapes (from 6x16 to 14x44 modules).
Which shape is used depends (in part) on how much data is to be encoded, and which compaction method is used.

In this context, and for this symbology, 'module' refers to a small, nominally square, shape which is either dark (usually black) or light (usually white).

Each symbol can be envisaged as an array of such modules, the array having a number of columns, and a number of rows.

If you are going to display or print such an array, one method is to consider each row separately, as a sequence of tiny squares, each square being either filled (black) or empty (white).

This is presumably the basis of printing such a symbol using raster graphics mechanisms.

But a suitable font can do just the same; at its simplest, such a font could contain just two characters, one which prints a filled square module, and one which 'prints' an empty square module.

In practice, the mechanism would be more efficient if the font contained rather more characters.

For example, the font I created for use with a transform for a PDF417 barcode ( a 'stacked' 2-D bar code rather than a 'matrix' one) contained 35 characters: 32 to represent binary 0 -> binary 31 (i.e. each character represented some linear combination of 5 modules, or bits); plus a separator character (binary '10') and special start and end row characters.
This was sufficient to be able to represent each of the possible 17-module wide black-white (bar-space) sequences which could be generated (plus the start & end sequences).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top