ZXing.Net
ZXing.Net copied to clipboard
Add to Options ability to specify narrow and wide bar widths
A helpful addition would be to allow specifying the narrow and wide bar widths. Doing so would allow printing smaller barcodes.
For example, I have an SDK to a particular label printer and, using that SDK, I can specify the narrow and wide bar widths in order to produce a barcode that is smaller in width. So, a 30-char barcode generated using narrow/wide bar widths of 2, outputs an image approx. 3" in width. The same 30-char barcode generated using narrow/wide bar widths of 1, outputs an image half the length -- 1.5 " in width.
Detailed explanation can be found here Basics of Barcodes in the section "Narrow Bar and Wide Bar".
any luck with this? I am facing issues while scanning low width barcodes on iOS
Hi, I'm writing an app to render ZPL commands and I'm facing the same problem.
I need a way to set the barcode bar width and wide bar to narrow ratio data that come from the ^BY command.
Do you know if it is possible and how?
A possible workaround and perhaps a really good solution would be if you generate the barcode with a width of 1 and manually stretch the image / changing the DPI settings of the bitmap afterwards. A width of 1 results in a bitmap with the smallest possible size. The narrow bars should have a size of 1 pixel.
Yeah, that's what I did. I render the barcode without setting the width and then render it again with the width I want using the resulting width of the first render and the barcode parameters I have.
Thanks
The solution is not optimal for the wide-to-narrow bar ratio because that's not what the zebra printer does so I have big imperfections between the rendering and the printer label. Can you suggest me the best way to implement it? If I get to a decent result then I'll submit a pull request with the code
As example for the CODE39 format the edit should be in the method:
private static void toIntArray(int a, int[] toReturn)
{
for (int i = 0; i < 9; i++)
{
int temp = a & (1 << (8 - i));
toReturn[i] = temp == 0 ? 1 : 2;
}
}
where instead of that 0 ? 1 : 2 there should be something like 0 ? 1 : wideBarRatio
Am I correct?