web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Problem with Code 128 barcode in NAV 2016

(0) ShareShare
ReportReport
Posted on by

Hello,

We need to print barcode labels using code 128 A.  Not a massive ask but proving considerably difficult.


On 2009 it worked fine using a method which created an image and embedded it on the label report.

We lost this when upgrading to 2015 and instead the barcode printed with a grey background which was not ideal but worked.

We have just upgraded to 2016 and no matter how, we cannot seem to get a barcode to print which can be scanned.

Am I missing something here?

I have searched and searched for a solution without any success.  I don't want other software to integrate alongside, I just want a barcode (code 128) to print on to a report (label) and I want it to scan.

I would appreciate any help or comment.

Many thanks

Bruce

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    Did you check this?

    www.archerpoint.com/.../printing-barcodes-rtc-report

  • Community Member Profile Picture
    on at

    Hi Mohana,

    Thank you.

    This is the solution that we have in 2015 but the barcode has a faint shading behind it which we are unable to remove despite the posts about it.

  • Luc van Vugt Profile Picture
    on at

    Hi Bruce, we are using barcode fonts to do this now. Works fine for us.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Bruce,

    I have tried doing it this way and it worked.

    kauffmann.nl/.../web-services-examples-part-3-generate-barcode

    You generate the barcode from web service and then you get a image you can use in your report.

  • Community Member Profile Picture
    on at

    Hi Luc,

    This is what we have for code, are you using anything like this?

    Any obvious mistakes to be spotted?

    EncodeBarcode128(pText : Text[250]) RetVal : Text[250]

    // How to encode a 128 barcode:

    //

    // Each character has a value ranging from 0 to 105. This value is used to calculate the check

    // character for each symbol.

    //

    // The check character is a Modulus 103 Checksum that is calculated by summing the start code

    // value plus the product of each character position (most significant character position equals 1)

    // and the character value of the character at that position. This sum is divided by 103. The

    // remainder of the answer is the value of the Check Character (which can be looked up from the

    // table). Every encoded character is included except the Stop and Check Character.

    //

    //

    // Example: BarCode 1

    // Message : Start B   B   a   r   C   o   d   e      1

    // Value      104      34  65  82  35  79  68  69  0  17

    // Position:   -       1   2   3   4   5   6   7   8  9

    // Calculate Total: 104 + (34x1) + (65x2) + (82x3) + (35x4) + (79x5) +

    //                  (68x6) + (69x7) + (0x8) + (17x9) = 2093

    // 2093/103 = 20 remainder 33

    // 33 = A

    // Final message: (Start B)BarCode 1(A)(STOP)

    //Codes for font from mibuso download CODE B

    StartChar:=154;

    StopChar:=156;

    Checksum:=154;

    FOR i:=1 TO STRLEN(pText) DO BEGIN

     currentchar:=pText[i];

     Checksum := Checksum +(i*(currentchar-32));

    END;

    ChecksumChar:= Checksum MOD 103;

    MESSAGE('checksum mod 103: ' + FORMAT(Checksum MOD 103));

    //KEENSOFT

    ChecksumChar:= ChecksumChar+32;

    {

    CASE ChecksumChar OF

    0: ChecksumChar:= 176; // B0h

    1..94: ChecksumChar:= ChecksumChar + 32;

    95..101: ChecksumChar:= ChecksumChar + 105;

    102: ChecksumChar:= 213; // D5h

    END;

    }

    //KEENSOFT

    MESSAGE('Checksum: ' + FORMAT(Checksum));

    // convert SPACE to ALT+0128

    pText:=CONVERTSTR(pText,' ','â–‘');

    MESSAGE('Checksum char: ' + FORMAT(ChecksumChar));

    RetVal:=STRSUBSTNO('%1%2%3%4',StartChar,pText,ChecksumChar,StopChar);

    EXIT(RetVal);

  • Luc van Vugt Profile Picture
    on at

    Bruce, my remark was meant in general. We have a value and use a font to display it.

  • Verified answer
    Binesh Profile Picture
    7,885 on at

    Hello Bruce Sutherland,

    In NAV 2016 some ASCII is changed, try this solution, it tested.

    Code128.png

  • Community Member Profile Picture
    on at

    Binesh,

    Thank you very much!

    This works a treat.

    Cheers

    Bruce

  • Community Member Profile Picture
    on at

    Thanks Christopher for the reply but this does not really meet what we are looking for.

  • Suggested answer
    Community Member Profile Picture
    on at

    It's possible that we are (Or were) using the same base library of functions that traditionally relied upon generating an image by streaming one byte at a time into a Blob using a local char variable. In my case the problem was caused by the switch to Unicode. I just changed the 'Char' type to a 'Byte' type and it worked - because it was no longer attempting to convert char value 255 into a unicode value.

    This is in NAV2015 , have not had an opportunity to try in later versions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans