Barcode generator v2

24

Comments

  • KAD_ICSKAD_ICS Member Posts: 3
    Thank you for posting the download.

    I am trying to use the tool to print a Delivery Point Bar Code (which I understand relates to the PostNet option.)

    I have formulated the DPBC and the Check Digit, but when I print the report to test, instead of the bar code, I see SIZE.

    An example Bar Code Value is 60130250816 and the Check Digit is 8.

    This is the code I am using:

    ok:= SHELL(STRSUBSTNO('%1%2%3%4%5%6',
    'c:\temp\Navibar.exe',
    ' ' + "DPBC Code" + FORMAT("DPBC Check Digit") +'{',
    '18'+'{',
    '120'+'{',
    '60'+'{',
    'c:\temp\bild.bmp'));
    Picture.IMPORT('c:\temp\bild.bmp');

    I have no problem generating the ean-nr bar code in the test report supplied with the download.

    I'd appreciate any advice anyone can offer. Thanks in advance,

    Kristine
    ](*,)
  • SavatageSavatage Member Posts: 7,142
    The Postal Service developed the POSTNET (POSTal Numeric Encoding Technique) barcode to encode zip code information on letter mail for rapid and reliable sorting by barcode sorters (BCSs).

    The POSTNET barcode can represent a five-digit ZIP Code (32 bars), a nine-digit ZIP+4 code (52 bars), or an eleven-digit delivery point code (62 bars).

    Your number is larger that 11 digits - maybe that's your SIZE problem.

    Maybe PostNet is the incorrect option :-k
  • KAD_ICSKAD_ICS Member Posts: 3
    Thanks for your reply, but I do believe postnet is the right option. I am trying to use a 11 digit delivery point code (tried both as a field variable, or a literal) And, I get the same error whether I include the check digit or not.

    I'm afraid time contstraints are going to force me to purchase a font. But, I'm still interested in any response that anyone might have.

    Thanks.

    K.
  • SavatageSavatage Member Posts: 7,142
    edited 2006-02-10
    KAD_ICS wrote:
    '18'+'{', <----Barcode Type
    '120'+'{', <----Width in pixels
    '60'+'{', <
    Height in pixels

    I did some testing and it turns out 120 is just too small for the width!

    I changed mine to 400 and it worked fine.

    Play around with that # until you find what you need.

    Did someone yell "Sweeeeeeet!"? :D
  • KAD_ICSKAD_ICS Member Posts: 3
    Bingo! Thank you kindly.
  • MauddibMauddib Member Posts: 269
    I'm not getting any errors from this but I am also not getting a BMP file generated. There is no indication that the program didnt run, it just simply doesnt output a BMP. If I use the picture.import line it errors saying file not found.
  • SavatageSavatage Member Posts: 7,142
    edited 2012-02-06
    Infact - it doesn't delete until next time you run the report.
    unless you added a FILE.ERASE('c:\barcode\temp.bmp'); line
    It should still be there is it ever was created.
    see the destination BMP file location

    example below..
    OnAfterGetRecord()
    IF Item."Item UPC/EAN Number" <> '' THEN BEGIN
    CreateBarcode:= SHELL(STRSUBSTNO('%1%2%3%4%5%6',
        'i:\navision attain\Navibar.exe',       // Program location
        ' ' + Item."Item UPC/EAN Number"+'{',   // code to generate from Nav
        '05'+'{',                               // barcode type "code" you want
        '120'+'{',                             // width in pixel
        '50'+'{',                               // high in pixel
        'c:\temp\barcode.bmp'));      // destination for the .bmp-file
    
    Picture.IMPORT('c:\temp\barcode.bmp');
    END;
    

    In the report section - Add a Picture Box w/sourceexpr; Picture

    I have globals
    CreateBarcode -> Integer
    Dataitem
    Item

    Note: possible Barcode Types Codes
    00-ISBN
    01-EAN 13
    02-EAN 8
    03-EAN 5
    04-EAN 2
    05-UPC A <
    the one I used in the above example
    06-Code 39
    07-Code 25 interleaved
    08-CodeBar
    09-Code 25
    10-Code 39 Extended
    11-Code 128 A
    12-Code 128 B
    13-Code 128 C
    14-Code 128
    15-EAN 128
    16-EAN 99
    17-UPC E
    18-PostNet
    19-Royal Mail
    20-MSI
    21-Code 93
    22-Code 93 Extended
    23-PZN
    99-None
    I needed to create a sheet of UPC labels depending on an Item# I selected (may not be crystal clear but you get the idea)
    **edit link dead**
    Updated the Var's to be more readable****
  • carmen1234carmen1234 Member Posts: 3
    Hello!

    Do I need to purchase a license for this executable? I have to use it for a client and it would be a real problem if, at some point, I would get a license issue.

    Can anyone answer me? I need an answer a.s.a.p.

    Thank you
  • SavatageSavatage Member Posts: 7,142
  • craig.scraig.s Member Posts: 4
    Ok. Clearly I am doing something stupid here. :)

    When I run this from the command line it works great!

    When I try and run it from Navision (v4.02 on XP) I get
    You are about to run the following executable for the first time:

    Executable: C:\Navision\Tools\Navibar\Navibar.exe,123456789098{01{120{60{C:\barcode.bmp
    Parameter:

    Please be aware that you may be running an executable that could potentially harm your computer.

    Do you trust this executable and its parameter?

    Now, I read what was written earlier by philippegirod about having to split the parameters into two arguments and have tried to do this but as you can see from above it is not working - the parameters and executable are all run together on one line and the parameter line is blank.

    This is my code
    IF "Cross-Reference Type" = "Item Cross Reference"."Cross-Reference Type"::"Bar Code" THEN BEGIN
      IF "Cross-Reference No." <> '' THEN BEGIN
        lIntOk := SHELL(STRSUBSTNO('%1%2%3%4%5%6',
             '''C:\Downloads\navibar2\Navibar.exe''',          // Programm
             ',''' + "Cross-Reference No." + '{',              // code to generate
             '01' + '{',                                       // EAN13
             FORMAT(gIntWidth) + '{',                          // width in pixel
             FORMAT(gIntHeight) + '{',                         // high in pixel
             'c:\barcode.bmp'''));                             // destination for the .bmp-file
    
        "Bar Code".IMPORT('c:\barcode.bmp');
    
      END;
    END;
    

    Can anyone please help me find what I am doing wrong?

    Thanks
    Craig ](*,)
  • craig.scraig.s Member Posts: 4
    OK. I think I have got it working - only having read back through this post a dozen times :lol:

    Here is my code now...(a report based on a single DataItem - Item Cross Reference)
    Globals
    Name	DataType	Subtype	Length
    gTxtPath	Text		250
    gIntWidth	Integer		
    gIntHeight	Integer		
    
    Item Cross Reference - OnAfterGetRecord()
    ==========================
    Name	DataType	Subtype	Length
    lAutWSHOM	Automation	'Windows Script Host Object Model'.WshShell	
    lTxtParam	Text		1024
    ==========================
    lTxtParam := 'C:\Downloads\navibar2\Navibar.exe ' +             // Program
                 "Cross-Reference No." +'{' +                       // code to generate
                 '01'+'{' +                                         // barcodetype
                 FORMAT(gIntWidth) +'{' +                           // width in pixel
                 FORMAT(gIntHeight) +'{' +                          // high in pixel
                 gTxtPath + '\' + "Cross-Reference No." + '.bmp';              // destination for the .bmp-file
    
    CREATE(lAutWSHOM);
    lAutWSHOM.Run(lTxtParam);
    
    CheckFileCreated;
    
    CLEAR(lAutWSHOM);
    
    "Bar Code".IMPORT(gTxtPath + '\' + "Cross-Reference No." + '.bmp');
    FILE.ERASE(gTxtPath + '\' + "Cross-Reference No." + '.bmp');
    
    MODIFY;
    
    CheckFileCreated()
    ==========================
    Name	DataType	Subtype	Length
    lBolExit	Boolean		
    lRecFile	Record	File	
    lIntCount	Integer		
    ==========================
    lBolExit := FALSE;
    lIntCount := 0;
    
    REPEAT
      lIntCount += 1;
      lRecFile.RESET;
      lRecFile.SETRANGE(Path,'c:\barcode');
      lRecFile.SETRANGE("Is a file",TRUE);
      lRecFile.SETRANGE(Name,"Item Cross Reference"."Cross-Reference No." + '.bmp');
      IF lRecFile.FIND('-') THEN
        lBolExit := TRUE
      ELSE BEGIN 
        lRecFile.SETRANGE(Path,'c:\');
        IF lRecFile.FIND('-') THEN;
          SLEEP(100); 
      END; 
    UNTIL lBolExit OR (lIntCount > 1000);
    

    Thanks all for your previous posts and thanks Ralph for putting this together in the fist place - Long live mibuso!!
  • Navsyst2Navsyst2 Member Posts: 29
    Hi,
    is it possible to print text as barcode with this barcode generator? For example 'test 123'.
  • TomKTomK Member Posts: 4
    Is it possible that the Barcode Generator doesn't work on Vista?
  • wqwq Member Posts: 2
    Dear all,

    I am quite new to this forum, just joined in 2 hours ago. Currently I need to print the barcode of "Invoice No." on my customized posted Sales Invoice document. My question is more or less the same as the one that was posted by "Navsyst2" dated Feb 02, 2007 "Is it possible to print text as barcode...?"

    I understood that barcode generator basically creates the barcode in "bmp" file format and attaches it to "BLOB" field (in this example, the author uses "Picture" field in Item table).

    I have reviewed some other barcode objects that were uploaded by some members here - i.e. "Barcode 128 with fonts + sample", EAN13 Barcode Generator (2 other topics). Basically they are able to produce printed barcodes. The barcode for "Invoice No." was nicely printed on my posted Invoice document. However, my problem is that my scanner does not recognize these printed barcodes. When I tried to scan it, nothing was written or produced on my text editors (Notepad, Word, Excel, etc.). For your information, I use cheap "handheld barcode scanner" that is normally used in small retail shop.

    Is there anybody experienced this and how to solve it? If I use "proper" barcode printer and print it, my "cheap" scanner is able to recognize this barcode. Do we need to do some adjustments on the barcode scanner itself?

    Thanks if anybody could help and give some comments.
  • MauddibMauddib Member Posts: 269
    You need to find out more informaation about the barcode you are printing. The font is just that, a font. It does not do things for you like Check Digit and start and end characters. You need to find out what these are for your format and print them too.

    for example some barcodes start and end with the * character. Also have a check digit. So to print the number 12345 you might actually have to print *12345x* where x is the check digit.

    So:

    1) Pick a format that suits you.
    2) LEARN about that format (start, end, check characters)
    3) Find a font for it and print the full code.
  • wqwq Member Posts: 2
    Hi Mauddib,

    Thank you for your feedbacks. I followed your instructions by adding '*' on the text to be scanned and set this on the scanner itself. And not it is working.
  • MauddibMauddib Member Posts: 269
    * was just an example. You need to find out what font you are using.... Code 128, 96 or whatever, and read about that code on the internet and find out what it uses. SOME barcodes use *. Some use other things. Find out what is right for the code you are using.
  • ATAT Member Posts: 20
    CheckFileCreated()
    ==========================
    Name	DataType	Subtype	Length
    lBolExit	Boolean		
    lRecFile	Record	File	
    lIntCount	Integer		
    ==========================
    lBolExit := FALSE;
    lIntCount := 0;
    
    REPEAT
      lIntCount += 1;
      lRecFile.RESET;
      lRecFile.SETRANGE(Path,'c:\barcode');
      lRecFile.SETRANGE("Is a file",TRUE);
      lRecFile.SETRANGE(Name,"Item Cross Reference"."Cross-Reference No." + '.bmp');
      IF lRecFile.FIND('-') THEN
        lBolExit := TRUE
      ELSE BEGIN 
        lRecFile.SETRANGE(Path,'c:\');
        IF lRecFile.FIND('-') THEN;
          SLEEP(100); 
      END; 
    UNTIL lBolExit OR (lIntCount > 1000);
    

    Craig.s, thank you for combining the code snippets, but your repeat until loop slows the code down too much. Sleep 100 for 1000 times means 100 seconds to wait if the bmp could not be created.
  • MauddibMauddib Member Posts: 269
    Another option if fonts and BMPs arent working for you is to draw your own barcode in the report. This is a time consuming one off job but pays in the long run as you can then simply port your code over to any other reports and print outs.

    Simply put:

    1) create a BMP which is completely black.
    2) Create an array of type INT which is, say, 160 myint[160] for example.
    3) Write a function that you feed a value and myint into. The function should map each Alphanumeric character to a binary string of 1s and 0s which it will put into each spot of your array.

    4) On your report create 160 bitmap place holders. In each one specify your bitmap list so that for a value of 0 it shows your black bitmap and for 1 it shows nothing. (note some barcodes are the other way around).
    5) Each bitmap placeholder should point to myint[1] myint[2] and so on.

    Et voila. You feed a value in, you get something like 010101111000011111000011 back and the bitmap is either shown or not accordingly. Not only is it easy but i get MUCH better scan quality in this fashion that with BMP or fonts.

    Again I stress the only way to do this is read a webpage on the particular code you want so you know how each character maps to binary, what check digit is needed and what start and end delimeters.
  • SavatageSavatage Member Posts: 7,142
    wq wrote:
    However, my problem is that my scanner does not recognize these printed barcodes. When I tried to scan it, nothing was written or produced on my text editors (Notepad, Word, Excel, etc.). For your information, I use cheap "handheld barcode scanner" that is normally used in small retail shop.

    Most handheld scanners come with some kind of Decoder & Scanner Programming manual. These manuals "Teach" the scanner how to read different barcodes depending on what you need.

    For example we use little handhelds too
    http://www.pos-x.com/product.asp?prodid=11 nothing fancy, works great
    and the manual to "Teach" it,
    http://www.pos-x.com/downloads/Xi1000_p ... manual.pdf

    So what i would do is find the maker of your scanner - go to their website and get the manual if you do not have it & program your scanner to read the other types of barcodes.

    Or
    1)add the invoice# to your report header section
    2)Change the Font for that field to BC C39 3 to 1 Narrow
    3)install fonts on all computers that are going to print this report http://savatage99.googlepages.com/BarcodeFonts.zip
    4)change the SourceExp of your Invoice# field to something like
    '*' + "Sales Invoice Header"."No." + '*'

    note the *'s are needed on barcode3of9

    save, compile, print
    ps make sure you make the field a decent size too, something like
    width=4500
    Hight=1300

    good luck
  • CuypzCuypz Member Posts: 56
    since I need to print 12-digit barcodes, the automatically adding of check digits isn't very helpful to me... Is there a workaround for this?
  • ATAT Member Posts: 20
    Cuypz wrote:
    since I need to print 12-digit barcodes, the automatically adding of check digits isn't very helpful to me... Is there a workaround for this?

    You have to use another barcode type for example Code39.
  • sisemsasisemsa Member Posts: 1
    I need to make labels with navbar, with dun-14... how can I make it??? there is not option for this... can you please help me?
  • SavatageSavatage Member Posts: 7,142
    These are the possible Bar Code Types Barcode Generator can create.

    00-ISBN
    01-EAN 13
    02-EAN 8
    03-EAN 5
    04-EAN 2
    05-UPC A
    06-Code 39
    07-Code 25 interleaved
    08-CodeBar
    09-Code 25
    10-Code 39 Extended
    11-Code 128 A
    12-Code 128 B
    13-Code 128 C
    14-Code 128
    15-EAN 128
    16-EAN 99
    17-UPC E
    18-PostNet
    19-Royal Mail
    20-MSI
    21-Code 93
    22-Code 93 Extended
    23-PZN
    99-None

    DUN-14 info
    http://www.activebarcode.com/codes/dun14.html
  • GRUBBYFANSGRUBBYFANS Member Posts: 154
    Why it is not Successfully??code here

    IF NOT ae.GET("No.","Sales Unit of Measure") THEN CLEAR (ae);
    IF ae."EAN-Nr."<> '' THEN BEGIN
    ok:= SHELL(STRSUBSTNO('%1%2%3%4%5%6',
    'C:\yan\navibar.exe', // Programm
    ' ' + ae."EAN-Nr."+'{', // code to generate
    '01'+'{', // barcodetype
    '120'+'{', // width in pixel
    '60'+'{', // high in pixel
    'c:\temp\bild.bmp')); // destination for the .bmp-file


    Picture.IMPORT('c:\temp\bild.bmp');
    END;


    But I write other method ,It is Successfully
    code here

    ltxtParam := 'C:\yan\Navibar.exe '+
    '1167937{13{120{60{C:\Temp\Picture.bmp';
    CREATE(lautWSHOM);
    lautWSHOM.Run(ltxtParam);
    CLEAR(lautWSHOM);


    Could you tell me reason???

    :-k
  • SavatageSavatage Member Posts: 7,142
    What's not successful about it?

    Is AE set in globals for Item Unit Of Measure?
    INfact change AE to ItemUnitOfMeasure - for readability

    Is it in OnAfterGetRecord trigger?

    Earlier in thsi post someone else thought it was failing and it tunred out the sizes were just not right (see Here)
    Savatage wrote:
    KAD_ICS wrote:
    '18'+'{', <----Barcode Type
    '120'+'{', <----Width in pixels
    '60'+'{', <
    Height in pixels
    I did some testing and it turns out 120 is just too small for the width!
    I changed mine to 400 and it worked fine.
    Play around with that # until you find what you need.
    Did someone yell "Sweeeeeeet!"? :D

    is OK an Integer? I changed OK to CreateBarcode - for readabilty.

    Is your Dataitem -> Item? I see your code to generate is still pulling info off the IUOM table.

    See cleaner code here:
    http://www.mibuso.com/forum/viewtopic.p ... c&start=37
  • IgnacyIgnacy Member Posts: 1
    Similar to iWinSoft Barcode Generator. Both of them worked fine for me. Thx for sharing.
  • SavatageSavatage Member Posts: 7,142
    Ignacy wrote:
    Similar to iWinSoft Barcode Generator. Both of them worked fine for me. Thx for sharing.

    That one is $34.95 tho
  • te6te6 Member Posts: 89
    Hi all ,

    To stop this kind of Error ,
    You are about to run the following executable for the first time:

    Executable: C:\Navision\Tools\Navibar\Navibar.exe,123456789098{01{120{60{C:\barcode.bmp
    Parameter:

    Please be aware that you may be running an executable that could potentially harm your computer.

    Do you trust this executable and its parameter?



    I used this code ::


    Name DataType Subtype Length
    ltxtParam Text 1024
    lautWSHOM Automation 'Windows Script Host Object Model'.WshShell

    Code
    ----
    ltxtParam := 'C:\Navision\Tools\Navibar\Navibar.exe '+
    '1167937{13{120{60{C:\Temp\Picture.bmp';
    CREATE(lautWSHOM);
    lautWSHOM.Run(ltxtParam);
    CLEAR(lautWSHOM);


    But while compiled , it is showing an error.. that
    Type conversion is not possible
    Text := Integer;

    plese tel me where I went wrong
  • tejateja Member Posts: 78
    Hi all,

    After I run the Reprot.
    When It reaches the code-->Picture.IMPORT('c:\temp\bild.bmp');
    It is raising the error : The Operating system cannot find the file 'c:\temp\bild.bmp'. Even though I created a folder named temp. I am not getting where I went wrong.

    Please guide me..

    Regards
    Teja
This discussion has been closed.