0

I've written label printing software (Windows, WPF, C#, .net 4.5) that happily prints barcodes with a Datamax H-Class printer, with one exception, when printing a barcode that starts with the character C

When I attempt this, the barcode is truncated up until the first numeric character within it.

Lower case c works fine, but as some of our model codes do start with C, I need to find a way to work around this.

I guess there must be some sort of escape character that would allow this? But I've not managed to find it via Google.

I'm not 100% sure it's a code128 issue either, could it be related to the Datamax H-Class printer, the Datamax Windows C# SDK or possibly the code128 font we're using on the printer?

Sorry the details are so vague, any help or advice on what to check next would be very much appreciated.

Update.

Just in case this is of any use (I doubt it though sadly) the code I'm using to send barcodes to the printer (successfully in the case of all barcode strings not starting with C ) is as follows:

ParametersDPL paramDPL = new ParametersDPL();

paramDPL.Align = ParametersDPL.Alignment.Left;
paramDPL.Rotate = ParametersDPL.Rotation.Rotate_270;

paramDPL.IsUnicode = false;
paramDPL.TextEncoding = Encoding.ASCII;
paramDPL.WideBarWidth = 7;
paramDPL.NarrowBarWidth = 4;
paramDPL.SymbolHeight = 60;

//if the stockCode starts with 'C' the barcode will be truncated                
docDPL.WriteBarCode("E", String.Format("{0} {1}", stockCode, serialNumber), COL_1, ROW_5, paramDPL);

The ParametersDPL object is from the Datamax C# SDK. The only possible problem I could see with the code is perhaps the setting of the IsUnicode or TextEncoding properties, but I've experimented with them quite a bit to no effect. None of the other properties on the ParametersDPL seemed like likely culprits either.

Ted
  • 2,525
  • 2
  • 37
  • 54
  • can you please share some of your code with us? this is a kind of an abstract question in that form – ymz Nov 27 '14 at 17:05
  • There you go ymz. Sadly I don't think it's down to anything wrong with the actual printing code though, as it works properly in all other cases. – Ted Nov 27 '14 at 17:52
  • is there any kind of logic behind 'stockCode'? or is it just a char /string with a letter? – ymz Nov 27 '14 at 18:00
  • @Ted Need some help figuring things out with DPL. Can you please help? – CuriousLearner Mar 18 '21 at 17:40
  • Is there a question on here that you want help with @Archan? – Ted Mar 19 '21 at 10:56
  • @Ted Struggled a lot during the weekend, forgot to check that I had posted something on SO, but ultimately figured it out after reading the entire manual. But my question was this: https://stackoverflow.com/questions/66697886/how-to-figure-out-size-and-location-data-from-a-command-in-datamax-programming-l – CuriousLearner Mar 22 '21 at 20:34
  • 1
    @Ted Thanks for the response, I honestly did not have much hope of getting a response on a question created 7 years ago. If there's more I need help with, I'll get back to you. – CuriousLearner Mar 22 '21 at 20:35
  • 1
    @ArchanJoshi I don't know how much I could have helped, as it's probably been 7 years since I did much DPL work! Glad to hear you worked it out - you should answer your own question too, to maybe help others, and as a reminder for yourself in future! – Ted Mar 23 '21 at 13:00
  • @Ted That sounds like a nice idea. Thanks for the tip. I'll surely answer the question. – CuriousLearner Mar 24 '21 at 02:23

1 Answers1

4

I'm unfamiliar with Datamax PCL, but the symptoms suggest that the "C" is being used to select subalphabet "C" of code128. It might be useful to try a stock code starting "A" or "ZB" and see whether the "A" or "B" disappears. If it does, then the first character may be being used to select a subalphabet ("A" is caps-only ASCII, "B" is no-controls ASCII.)

You'd then need to look very closely at Datamax PCL format - it may be that there's a (possibly opional) formatting character there, which makes it leading-character-sensitive. Perhaps forcing in a leading "B" would cure the problem.

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • Mr Magoo, you are entirely correct, and a prince among men, thank you very much! Simply prefixing A, B or C on the barcode string acts as a character set selector (a slightly dodgy method on the part of the Datamax SDK I'd say), so I'm now adding a B (not 'ZB'! That was a typo I guess?) to the start of every barcode, and all stock codes are printing happily. – Ted Nov 28 '14 at 10:27