1

I'm converting in a visual studio's console application some strings into barcode128 format.

My problem is with the "space" ( ): I can't convert it in any form, I have the barcode128 library for word and it doesn't convert space, but he simply splits two barcodes making them impossible to read.

I read to replace ASCII 32 ( ) with ASCII 194 (┬) but this ascii is not converted by word. How can I convert into barcode128 a string with a space?

Example "PROP. LOG."

thanks all

MethodMan
  • 18,625
  • 6
  • 34
  • 52
Pier Giorgio Misley
  • 5,305
  • 4
  • 27
  • 66
  • Take a look at this BarCode Generator site http://generator.barcoding.com/ it will convert `PROP. LOG` into the a barcode see if they have an API as well also look at this link http://www.keepautomation.com/guide/csharp_barcode_generator.html – MethodMan Feb 05 '16 at 17:04
  • There's no such thing as "ASCII 194". ASCII only goes up to 127. It's not clear whether the character you've specified (U+252C, I suspect) is really what you want... or where Word comes into this, to be honest... – Jon Skeet Feb 05 '16 at 17:06

1 Answers1

1

Whether the space character needs special treatment depends on the actual font you are using.

But fonts seem to miss a working code point for a space where you would expect it. While defined (with a pattern of '11011001100' and with weights of '212222') some fonts out there seem to not have it at the same spot. You probably use a Font that doesn't contain a proper space character at 32.

So you will have to find out where the space character is in your font.

One free Font that does have it at 32 is to be found here.

I looked into a few other free fonts and found that they have the space character at 223.

The control codes also were misplaced. Wikipedia says to this:

The encoded ASCII char depends on the actual used barcode-font. Especially the ASCII char of value 0 and of value 95 and above can be defined differently in the font that is installed.

According to the code numbers in the table this may or may not include the space character..

Here are the constants that worked for me:

    char FNC1 = (char)181;
    char FNC4 = (char)220;
    char StartA = (char)192;
    char StartB = (char)193;
    char StartC = (char)194;
    char Stop = (char)200;
    char ShiftAB = (char)252;
    char Space = (char)223;

Update As I found the mess the various fonts provided too much I decided to go with drawing the barcodes I will eventually need myself. Not hard at all and I can stay with the codes as set in the standard tables..

TaW
  • 53,122
  • 8
  • 69
  • 111
  • Good to hear! I am curious: Which font did you use? and did to use the space@223? – TaW Feb 08 '16 at 13:36
  • One sec sorry, it worked for some barcodes but for others no..:( I had a "barcode-code" generator wich converts a string into a barcode string(it needs the start-stop-checksum). but some barcodes had a start-stop character wich was not present in the font you suggested.. – Pier Giorgio Misley Feb 08 '16 at 13:39
  • anyway I tred another font and he did convert the space with char 223. so it was ok, the problem was the start. I think I solved it now but I used a workaround.. instead of converting the string in a barcode string, I used a Nuget package and I converted it into an image directly.. Your answer is still correct because it was my fault since I didn't explain the problem correctly. Thanks because with your link and tip you pointed me to this solution, and sorry for my bad english :) – Pier Giorgio Misley Feb 08 '16 at 13:42