Interleaved 2 of 5 Barcode Creator

Administrator
Member, Moderator, Administrator Posts: 2,506
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.
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.
0
Comments
-
Hi,
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?0 -
Hey,
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:
Igor0 -
I'm almost there (I guess..)
What do the 2 lines do who are marked with the comment '//?' ?charInf := 'B' ; poutBmpHeader.WRITE(charInf, 1); charInf := 'M' ; poutBmpHeader.WRITE(charInf, 1); poutBmpHeader.WRITE(54 + pintRows * pintCols * 3 , 4); //SIZE BMP poutBmpHeader.WRITE(0, 4); //APPLICATION SPECIFIC poutBmpHeader.WRITE(54, 4); //OFFSET DATA PIXELS poutBmpHeader.WRITE(40, 4); //NUMBER OF BYTES IN HADER FROM THIS POINT poutBmpHeader.WRITE(pintCols, 4); //WIDTH PIXEL poutBmpHeader.WRITE(pintRows, 4); //HEIGHT PIXEL poutBmpHeader.WRITE(65536 * 24 + 1, 4); //? poutBmpHeader.WRITE(0, 4); //NO. OF COLOR PANES & BITS PER PIXEL poutBmpHeader.WRITE(0, 4); //? poutBmpHeader.WRITE(2835, 4); //HORIZONTAL RESOLUTION poutBmpHeader.WRITE(2835, 4); //VERTICAL RESOLUTIONETTE poutBmpHeader.WRITE(0, 4); //NO. OF COLORS IN PALETTE poutBmpHeader.WRITE(0, 4); //IMPORTANT COLORS
0 -
First is the color depth of the image:
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.
Igor0 -
This is the result when I increase the size x5 (takes about 5 sec to build
):
This is the result when I increase the size x2
Any idea when the 2nd one looks so crooked?0 -
Hello,
that depends where have you increased the sizeAs 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?
Igor0 -
Found it!
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>0 -
Hello,
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>Marcelo Borges
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com0 -
Guys, Thanks for sharing this solution.
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.0 -
Thank you for this wonderful solution.
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 codeCLEAR(gvBinary);
in the function CreateBarcode.0 -
zannaleer wrote:Thank you for this wonderful solution.
It works perfectly.zannaleer wrote: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 codezannaleer wrote:CLEAR(gvBinary);
in the function CreateBarcode.0 -
First of all, Great Solution, and thanks to Igor Pchelnikov.
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.
Jordi0 -
Somehow for NAV2013R2, the RGB code for white is not 255, it is 160. Just replace the RGB code of 255 with 160 to get White.0
-
Anyone using it now in production? do you have an example with scaling?
If you are not using it because of problems or are not sure how it would work in production, what do you use?0 -
We are using it in production for more than one year. In Nav2013 and it's white and gray, we have to adjust that...Regards
Christer in Stockholm, Sweden0 -
We are going to use it for production. Not sure what you mean by scaling.0
-
HI,
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 ..?0 -
Hi all, I'm using this code to print barcodes to product labels, but now a specific label is needed on which the barcode is rotated 90 degrees. Is this possible?! Thanks in advance!"Make it idiot-proof and someone will invent a better idiot..."0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions