FAQ TBarCode DLL / TBarCode Library
How Can I Improve Speed with Save Image?
How Can I Improve Speed with Save Image?
To speed up the printing of the barcodes, the following options are suggested:
BCBitmapToMemory
Instead of BCSaveImageToBuffer you can use BCBitmapToMemory which should be faster. For more information see API Reference - BCBitmapToMemoryA .
Note that BitmapToMemory does not support font rendering and also uses a different unit when passing the size. If you receive the error code for insufficient memory (eErr_OutOfMemory), increase the buffer size (use the returned *pnSize value) and call the function again. The size of the created bitmap has an influence on the speed as well (but not that much).
Draw Mode
You can change the draw mode to "compatible", which should result in significantly better performance. For more information see API reference - BCSetDrawModeExt .
However, the "compatible" drawing mode sometimes produces enlarged bars/dots (or the opposite), the deviation is 1 pixel. This draw mode uses the GDI Rectangle function – it depends on the graphics/video driver and also on the printer driver if the bars are drawn correctly. In about 90-95% of the use cases the resolution does not matter (the deviation of 1 pixel can be ignored with a 1200 dpi printer), but with low-resolution bitmaps, 1 pixel is already a lot. For this reason, testing is important.
Set this before you call BCDraw or BCSaveImage:
BCSetDrawModeExt (pBarCode, eDrawMode_Compatible);
Multi-Threading
For multithreading you should consider also these hints: