FAQ TBarCode/X - Barcode Software for Mac OS X®, UNIX®, Linux®
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
-d"0112345678901231"
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.
No Human Readable Text on Bitmap Exports
TBarCode/X has no built-in support for rendering fonts for bitmap exports. This would require an additional font rendering library. This applies only to bitmaps, our vector formats (EPS, SVG, PCL...) support human readable text. See also our data sheet.
You can use the following workarounds or alternative products:
TBarCode/X
Export in EPS format and convert the file to a bitmap format (BMP, PNG, JPG...) with ImageMagick convert or Ghostscript gs (open source tools). You can also export in SVG format and use convert.
Pay attention to the image resolution (
module width adapted to DPI) and the consistency of the resolution/quality. The conversion should not change the resolution or anti-alias the image.
TBarCode Library: You can create the entire output with the Custom Drawing API. You receive separate callbacks for the bars and the text, each with the coordinates of where to draw. The font output and bitmap export must be realized via a separate library (own code).
TFORMer
Employ our TFORMer Labelling SDK on Linux, offering robust font rendering support for barcodes across various output formats (BMP, PNG, JPG, TIF, PDF, etc.). This comprehensive solution includes a command line tool and a developer library. While templates are designed using TFORMer Designer on Windows, the SDK enables users to generate a wide range of output formats on Linux.
If you need only the barcode, create a simple label sheet with one bar code and export it with TFPrint to a bitmap file. The data can be supplied as CSV or XML file.
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
origin=BOTTOM
How to Generate Swiss QR Code in a PCL Print Job?
To generate a Swiss QR Code, add the following control sequences to your PCL File:
- Start of the barcode: $_tbcs -fPCL -b126 -w46 -h46 -eon -d
- Then the data in double quotes: "<Data structure according to SIXX specification 2.2>"
- The end of barcode: $_tbce
Example of Swiss QR Code (the line feeds are encoded with \n):
$_tbcs -fPCL -b126 -w46 -h46 -eon -d"SPC\n0200\n1\nCH4431999123000889012\nK\nRobert Schneider AG\nRue du Lac 1268\n2501 Bile\n\n\nCH\n\n\n\n\n\n\n\n123.59\nCHF\nK\nPia-Maria Rutschmann-Schnyder\nGrosse Marktgasse 28\n9400 Rorschach\n\n\nCH\nQRR\n210000000003139471430009017\nInstruction of 15.09.2019\nEPD"$_tbce
- To see the Swiss cross in the middle of the barcode, switch to PCL5noHPGL. This can be done either in the prefix parameters with --pclmode=PCL5noHPGL (e.g. insert after -fPCL) or permanently in the tbarcode.conf file with pclmode=PCL5noHPGL (insert additional line at the end).
- The data is transferred as ANSI ⁄ Latin-1, but encoded as UTF-8 in the barcode. The UTF-8 encoding is generated internally by the barcode generator.
- The barcode generator has a built-in validation, i.e. if the data structure does not match the specification, an error is output on stderr (as well as an exit code <>0). If required, tracing can be activated in tbarcode.conf.
- By default, a relative insertion position is used. Optionally, you can still control the exact position absolutely or change the origin - see User Manual: --pos --xpos --ypos --origin.
- This Excel-Sheet may help you to create the data structure: https://www.tec-it.com/Download/Samples/Swiss_QR-Bill_V2.zip.
- The existing demo version can be used for testing without any restrictions. The final activation is done via a license file (no new installation necessary).
How to Create Bitmaps and SVG for HTML Output?
Below are sample calls for bitmap creation. The bitmaps are already optimized for 100 and 300 dpi. You can load these bitmaps on-the-fly into the browser through a dynamically created bitmap file (random/timestamp-based file name). As an alternative you can use also vector graphics via SVG format.
Code 39 (GIF)
tbarcode -fIMAGE -iGIF -oBarcode.gif -b8 -m0.254 --dpi=100 -d"1234567890ABC"
For efficiency, a value of 100 DPI has been chosen here, but you can increase the DPI value to 300 if necessary.
QR-Code (PNG)
tbarcode -fIMAGE -iPNG -oBarcode.png -b112 -m0.508 --dpi=300 -d"www.tec-it.com"
Quality optimisation:
- The module width (smallest graphic element in the code) was already adjusted to the pixel grid in the bitmap. At 100 dpi, 0.254 mm corresponds exactly to one pixel, at 300 dpi it is 3 full pixels (so there are no quantisation effects or rounding errors). At 300 dpi, a dot size of 0.508 mm corresponds to 6 full pixels (again, no quantisation effects).
- You can also specify a target value for the module width -m (or the total width -w) and use the internal optimization via the parameter --optimalwidth. The barcode can then become smaller than the target value, as it is always rounded down to full pixels.
- When displaying and printing, the resolution of the display and the printer are taken into account. Depending on the DPI, rounding errors may occur.
QR-Code (SVG)
tbarcode -fSVG -oBarcode.svg -b112 -m0.762 -d"https://www.tec-it.com"
The vector format SVG is also supported, most browsers can display this by now. In SVG format, we also have a plain text line for 1D codes.
HTML integration:
With the SVG format, you can either load the SVG via an <img src="svg-url"> tag as with the bitmap or directly integrate it inline into the HTML as <svg> nodes (no extra image download required). For inline integration, omit the first line from our SVG file, you only need the <svg> node. The display size (viewBox) can also play a role.
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.
How to Integrate the Spool Filter into the Windows Printing System?
A direct spool filter integration is not supported in Windows; the filter must be called separately in a script or program code. If you have a PCL print job, call the following command before sending the PCL file to the printer:
tbarcode --filter <infile.pcl >outfile.pcl
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.
TBarCode/SAPwin
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.
TBarCode/Direct
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
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.