FAQ TBarCode DLL / TBarCode Library
What Is the Best Way to Create and Draw a Barcode?
What Is the Best Way to Create and Draw a Barcode?
In general we suggest this procedure for the API calls:
- Set all bar code properties; type, text, size mode, module width, orientation, DPI, etc.
- Call BCCreate() - afterwards do not change any properties.
- For linear (non multi row) barcodes choose a desired height (by yourself!)
- Prepare the bounding rectangle: Use a default width and your desired height (step 3). Rotate the rectangle if required (exchange width and height for 90/270°).
- Retrieve bar code size: BCGetBarcodeSize() - use the prepared (rotated) bounding rectangle (step 4).
- Now set width and height of drawing rectangle by using the size values returned in step 5. Also consider orientation here.
- Draw the bar code with this rectangle.
Should I Use a Specific Module Width ?
We suggest to use a custom module width whenever possible - adjusting the narrow bar width gives you more control over the output. It also allows you to comply to specific label requirements and to the printer's output resolution. There may be one exception: For postal bar codes, where the bar code size has to be in an exact range, the bounding rectangle may be sufficient.
Example values for the module width (300 dpi compliant):
- Linear types: 0.254 mm, 0.339 mm
- PDF417: 0.254mm (row height set to 0.762 mm)
- 2D Matrix codes: 0.508 mm
For bitmap output the module width may be adapted to bitmap resolution (e.g. 96 dpi). Here you could use the BCGetOptimalBitmapSize API call (see also FAQ about Optimal Bitmap Size).