Interleaved 2 of 5 Barcode Creator
Barcode is generated to ostream, so can be used as a picture in reports. No fonts needed - data is written directly as a bitmap.
BMP header is simplified - can be adjusted depending on your needs (look BMP specs).
Use at your own risk
http://www.mibuso.com/dlinfo.asp?FileID=1185
Discuss this download here.
Comments
I think this is a wonderful solution! =D>
No more hassle with fonts, automation, external programs, ...
Since I'm using the bmp piece of code myself for other barcodes, I was wondering if there's a solution to scale the bmp?
for the scale - you might check wiki link and adjust all the stuff you need. This code is very simplified, w/o any pro stuff, so you can do whatever you want there
Use BMP header adjustment and also manual scaling for BMP bars writing (in repeat clause).
(Don't forget about height/width proportions for barcodes, for example 128 barcode height should be at least 15% of it's width and so on, all this stuff is also available in this example and easy to adjust).
This basis can be also used for other barcodes implementation, such as 128,39,93 and so on. Just use it's logic and fill up bigtext variable with 0/1 (space/bar) and vuala :whistle:
Igor
What do the 2 lines do who are marked with the comment '//?' ?
65536*24 + 1 = 180001 (Hex) -> that means 1 plane is used and 24 bits per pixel.
Second is the size of BMP data - that's not FILE SIZE. Can be left blank (header is simplified, but it's better to calculate it), but you can also calculate it pvRows * pvCols * 3.
Hope it helps.
Igor
This is the result when I increase the size x2
Any idea when the 2nd one looks so crooked?
that depends where have you increased the size As from picture I can see that there are difference in bytes (tail bytes are not filled properly), You have somewhere mistake in repeat clause.
Paste the source here, and what is the barcode type here?
Also why d'you need such big barcodes?
Igor
It were indeed the trail bytes.
The reason I want to scale the barcodes is to use in reports.
There I import the resulting Blob in a picturebox.
Since the bmp is shown in the resolution it was made, it can apear pretty small in some reports where it needs to be for example 1/2 of the page.
Once again many thanx and thumbs up for the brilliant idea!
=D>
I just wanted to congratulate the developer Igor Pchelnikov for this wonderful solution. I'm here in Argentina, doing the Electronic Invoice and they require this exactly standard.
I implemented this on my system and it's working perfectly!
Congratulations again!
Best regards, =D> =D> =D>
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com
Can you please update this thread with the detailed solution for scaling? As an ERP developer I am not realy used to bits and bytes.
Thanks again.
It works perfectly.
I had a little problem with this codeunit when I've called it twice or more.
The bitmap growed with every call. I've solved it with this code in the function CreateBarcode.
However, in NAV2013R2, the generated barcode bmp is grey and black and not white and black.
I did try in NAV2009, and I got the barcode correctly in white and black.
I compared the bmp file created in NAV2009 and NAV2013R2, and they are different. Somehow NAV2013R2 must have written the text file in a different format resulting in a different bmp file.
Jordi
If you are not using it because of problems or are not sure how it would work in production, what do you use?
Christer in Stockholm, Sweden
i am using the same code unit .
but my barcode is printing in black and gray.
how can i change it in to black and white ..?