mibuso.com

Microsoft Business Solutions online community
It is currently Sun Mar 29, 2015 11:22 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jun 23, 2010 8:15 pm 
Offline
Site Admin

Joined: Sun Nov 07, 1999 7:01 am
Posts: 2136
Location: Wilrijk, Belgium
Country: Belgium (be)
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.


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Mon Jul 05, 2010 5:27 pm 
Offline

Joined: Thu Mar 15, 2007 2:08 pm
Posts: 180
Country: Belgium (be)
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?

_________________
My Nav Blog


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Tue Jul 06, 2010 11:30 am 
Offline

Joined: Mon Sep 21, 2009 1:01 pm
Posts: 21
Location: Litauen
Country: Lithuania (lt)
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 :D
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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Tue Jul 06, 2010 7:20 pm 
Offline

Joined: Thu Mar 15, 2007 2:08 pm
Posts: 180
Country: Belgium (be)
I'm almost there (I guess..)
What do the 2 lines do who are marked with the comment '//?' ?

Code: Select all
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

_________________
My Nav Blog


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jul 07, 2010 10:03 am 
Offline

Joined: Mon Sep 21, 2009 1:01 pm
Posts: 21
Location: Litauen
Country: Lithuania (lt)
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.
Igor


Top
 Profile E-mail WWW  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jul 07, 2010 5:21 pm 
Offline

Joined: Thu Mar 15, 2007 2:08 pm
Posts: 180
Country: Belgium (be)
This is the result when I increase the size x5 (takes about 5 sec to build :| ):
Attachment:
EAN13.bmp
EAN13.bmp [ 167.4 KiB | Viewed 4454 times ]


This is the result when I increase the size x2
Attachment:
EAN13 2.bmp
EAN13 2.bmp [ 26.91 KiB | Viewed 4454 times ]


Any idea when the 2nd one looks so crooked?

_________________
My Nav Blog


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jul 07, 2010 7:12 pm 
Offline

Joined: Mon Sep 21, 2009 1:01 pm
Posts: 21
Location: Litauen
Country: Lithuania (lt)
Hello,
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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jul 07, 2010 10:51 pm 
Offline

Joined: Thu Mar 15, 2007 2:08 pm
Posts: 180
Country: Belgium (be)
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>

_________________
My Nav Blog


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Tue Apr 05, 2011 2:33 pm 
Offline

Joined: Fri May 19, 2006 3:58 pm
Posts: 119
Location: Campinas
Country: Brazil (br)
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
Campinas, SP - Brazil
Navision Senior Developer


Top
 Profile E-mail  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Thu Apr 28, 2011 8:28 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Tue Jul 19, 2005 3:49 pm
Posts: 4196
Location: Olst
Country: Netherlands (nl)
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.

_________________
Mark Brummel | Freelance Dynamics NAV (Navision) Specialist

Read my new book: Microsoft Dynamics NAV 2013 Application Design

MY BLOG : http://markbrummel.wordpress.com


Top
 Profile E-mail WWW  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Aug 10, 2011 11:58 am 
Offline

Joined: Wed May 14, 2008 10:04 am
Posts: 4
Location: Oldenburg
Country: Germany (de)
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 code
Code: Select all
CLEAR(gvBinary);

in the function CreateBarcode.


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Sun Sep 04, 2011 11:25 am 
Offline

Joined: Thu Mar 15, 2007 2:08 pm
Posts: 180
Country: Belgium (be)
zannaleer wrote:
Thank you for this wonderful solution.
It works perfectly.

My pleasure
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 code

Strange, I don't have that problem...
zannaleer wrote:
Code: Select all
CLEAR(gvBinary);

in the function CreateBarcode.

This line makes NAV crash... I supose you mean CreateBarcodedetail?

_________________
My Nav Blog


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jan 14, 2015 6:19 am 
Offline

Joined: Thu Jul 14, 2005 8:04 am
Posts: 134
Location: Malaysia
Country: Malaysia (my)
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.

Jordi


Attachments:
bmpfromCU80000.bmp
bmpfromCU80000.bmp [ 8.49 KiB | Viewed 525 times ]
Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Wed Jan 14, 2015 10:06 am 
Offline

Joined: Thu Jul 14, 2005 8:04 am
Posts: 134
Location: Malaysia
Country: Malaysia (my)
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.


Top
 Profile  
 
 Post subject: Re: Interleaved 2 of 5 Barcode Creator
PostPosted: Thu Jan 15, 2015 9:59 am 
Offline

Joined: Tue Jun 21, 2011 12:39 pm
Posts: 598
Country: Netherlands (nl)
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?


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: