How to Generate GS1 DataMatrix (EPS or Bitmap)?

The following samples show how to create a GS1 DataMatrix image through command line. The samples don't cover spool filter operation (e.g. for SAP).

Output in EPS format, GS1 DataMatrix marked by FNC1 on the first position, module width (dot size) of 0.508 mm

tbarcode -fPS -oBarcode.eps -b71 --DMformat=1 -eon -m0.508 -d"0112345678901231"

Output in GIF bitmap format, 300 dpi, same settings as above

tbarcode -fIMAGE -iGIF -oBarcode.gif -b71 --DMformat=1 -eon -m0.508 --dpi=300

If you need to fit the module width to the pixel grid exactly, you can use the --optimalwidth parameter

tbarcode -fIMAGE -iGIF -oBarcode.gif -b71 --DMformat=1 -eon -m0.508 --dpi=300
        --optimalwidth -d"0112345678901231"

For label printers with a resolution of 203 dpi (thermal transfer) you should adjust the module width for a 203 dpi grid.

tbarcode -fIMAGE -iGIF -oBarcode.gif -b71 --DMformat=1 -eon -m0.500493 --dpi=203
        --optimalwidth -d"0112345678901231"

The FNC1 field separator (used for variable length fields) is inserted into the data string as \F. Eventually you have to encode it in the command line as \ or \\ (e.g. \\F).

tbarcode -fIMAGE -iGIF -oBarcode.gif -b71 --DMformat=1 -eon -m0.508 --dpi=300
        -d"vvvvvv\Fnnnnnn"  (v… data with variable length - use AI)

For inkjet printers you can reduce the bar width to avoid issues with blurred ink. For 10% reduction of the module width add:

 --reduction=10 --reductionunit=perc

These examples use sample values for data matrix size (module width). Larger barcode symbols are possible and recommended for better readability. Just watch out for the correct settings according to the specifications of your printer (dpi, dot size).

How can I set the PDF417 Row Height?

The following samples show how to create a PDF417 bitmap file with a specific row height. The samples don't cover spool filter operation.

Output in JPG bitmap format, 96 dpi, module width = 1 Pixel, row height = 3 Pixels, data columns = 5

tbarcode -fIMAGE -iJPG -oBarcode.jpg -b55 --dpi=96 -m0.264583 -h20 --PDFcols=5
        --PDFrowheight=0.79375 -d"ABCDEFG1234567890"

Same as above but with reduced row height / module width ratio (2:1).

tbarcode -fIMAGE -iJPG -oBarcode.jpg -b55 --dpi=96 -m0.264583 -h20 --PDFcols=5
        --PDFrowheight=0.52917 -d"ABCDEFG1234567890"
Although not influencing the resulting bar code height, the height parameter must be specified.

Barcodes Shifted Downward (PCL Coordinate System)

The coordinate system with PCL draws from top to bottom, thus from the cursors position downward. If you want to draw from the current cursor position upwards you can adjust this in the tbarcode.conf file.

Insert a new row in the tbarcode.conf file:

# set origin of barcode to left bottom corner of bounding rectangle

TBarCode/X Filter Not Applied in CUPS PCL Queue

First make sure the mime.types file contains the header sequence for PCL and the mime.convs file contains the correct conversation route from PCL to octet-stream. The mime.convs must also include a call to the TBarCode filter script, alternatively, this can be done in the PPD file. See more details on how to configure this for your CUPS version in the TBarCode/X user manual.

Next, either the origin mime-type of the print job is determined by “auto-typing” in CUPS (with the help of mime.types) or you preset a document type for the queue in question.

You can preset a PCL document type for a queue as follows:

lpoptions -o document-format=application/vnd.hp-pcl -p MYPCLQUEUE

You can set it also on a per job base:

lp -d PRINTERNAME -o document-format=application/vnd.hp-pclpathtojobfile

This avoids autotyping for the filter and can solve issues if the print job is not correctly recognized as PCL job.

Which Barcode Product Is Best Suited for My Environment?

TEC-IT offers three different solutions for bar code generation in SAP. Each solution has its special advantages and characteristics.


This Barcode DLL is recommended for Microsoft® Windows environments in which you can print centrally via a print server with SAPSprint (spooling software of SAP) or on the SAPGUI client (front-end printing). Any printer using Windows drivers can be connected. The Barcode DLL is also the solution of your choice in case of Unicode printing with SWINCF or other CF device types.


If your company mainly uses PostScript® compatible printers, then TBarCode/Direct is the best solution. No middleware, central installation, all printers (with PostScript).


TBarCode/X is an all-round barcode software solution for UNIX®, Linux® and Mac OS X® environments. TBarCode/X can be installed into the spool system of a print server (or on the SAP server itself). Suitable for PCL and PostScript® printers. Existing device types for PCL printers can be reused, no change to Windows drivers required.