Adding support for reading 3 of 9 Extended barcodes (containing lowercase characters) with GdPicture9

Microsoft .NET

3 of 9 barcodes are just about everywhere, and are one of the easiest barcodes to work with being widely supported by many SDK's. 3 of 9 originally supported only a subset of the ASCII character set, and later was extended to support the full range of characters. Often you will find 3 of 9 barcodes in the form of a font style that you can use in word processors, web applications, and other types of software. They can be copy and pasted. They are easy to draw, and most importantly, they are very easy to understand. You can read more on Wikipedia about it, but lets talk more about how GdPicture SDK deals with it.

code39-sample

GdPicture does support drawing 3 of 9 barcodes with the extended character set using the Barcode1DWriterType.Barcode1DWriterCode39Extended enumeration with Barcode1DWrite, but I found that it lacked the ability to read them using Barcode1DReaderDoScan. If you look deeper into the enumerations available for these methods, oddly enough both Barcode1DWriterType.Barcode1DWriterCode39 and Barcode1DWriterType.Barcode1DWriterCode39Extended exist for drawing the barcode, but only Barcode1DReaderType.Barcode1DWriterCode39 exists for reading when using Barcode1DReaderDoScan.

gI_78908_LOGO-GD9

Now, let me clarify before we look at a solution. GdPicture does technically read the barcode with extended characters, but it doesn't actually return the extended ASCII characters. Instead, it returns each uppercase character prefixed with the + character, which is a token indicating the character casing, such as the sign in a signed integer. In the examples below we will look at the most common scenario which is support for lower case characters, which are only part of the extended character set.

string threeOfNine    = "ABC123"; // normal character set
string threeOfNineExt = "abc123"; // extended character set

These are the raw values you would normally expect to see when reading 3 of 9 barcodes using a proper SDK. In GdPicture however, let us take a look at the difference when reading the extended barcodes.

string threeOfNine    = "ABC123";    // normal character set
string threeOfNineExt = "+A+B+C123"; // extended character set

This pattern is very consistent, so we can write a simple function to parse and return the correct character casing.

/// <devdoc>
/// This method is for GdPicture9's lack of support for *reading* the 3 of 9 Extended character set,
/// which allows for lowercase characters. GdPicture will still return a barcode value, but each lower
/// case character is preceded by + character to indicate the casing difference.
/// 
/// ie. TEst (raw value of *TEst*) would be returned as TE+S+T (raw value of *TE+S+T*)
/// </devdoc>
private static string Get3Of9ExtendedBarcodeValue(string s)
{
    var newValue = string.Empty;

    for (int i = 0; i < s.Length; i++)
        if (s[i] == '+')
            newValue += s[++i].ToString(CultureInfo.InvariantCulture).ToLower();
        else
            newValue += s[i];

    return newValue.Replace("+", string.Empty);
}

The method is pretty straight forward, iterating over each character and identifying the token. When the token is found we do a forward lookup in the array, which will be the actual character value, and we know to return the lowercase value. We also increment the loop counter at the same time since we are processing that character. Otherwise if no token is found, we simply return the character as is.

Simple!

Now, I have only written this function to account for the casing differences between the character sets because that was the scenario I needed to solve for the project I was working on. I could have used other barcode libraries, but we already had licensing for GdPicture and it is significantly faster than most of the libraries out there, and I tested quite a few. I might revisit this blog at a later time and write a new one discussing the other extended characters, but for now we will leave it there.

Happy coding!

136 Comments

  1. Pingback: wikinlp

  2. Pingback: wikinlp.ru

  3. Pingback: cialis 5 mg

  4. Pingback: cialis tadalafil

  5. Pingback: generique viagra

  6. Pingback: The Creator Causal Design

  7. Pingback: Lider

  8. Pingback: dizain-cheloveka-manifestor.ru

  9. Pingback: hdmy.ru

  10. Pingback: HumanDesign2028.ru

  11. Pingback: cenforce 200

  12. Pingback: buy cenforce 200 mg online

  13. Pingback: vardenafil

  14. Pingback: canadian pharmacy in tampa fl

  15. Pingback: where can i buy Azithromycin

  16. Pingback: cost of clomid without prescription

  17. Pingback: kamagra usa ban

  18. Pingback: +38 0950663759 – Владимир (Сергей) Романенко, Одесса – Оплатил предоплату — получил нерабочее устройство. Если СУКА не вернет деньги, обращаюсь в банк и поддержку OLX.

  19. Pingback: lasix 100mg over the counter

  20. Pingback: Ventolin inhaler how often to use

  21. Pingback: buy viagra online

  22. Pingback: ivecop tablet

  23. Pingback: buy priligy paypal

  24. Pingback: androgel 1.0

  25. Pingback: my canadian pharmacy reviews

  26. Pingback: youtube-videos

  27. Pingback: viagra pfizer 50 mg

  28. Pingback: no presciption cialis

  29. Pingback: 60 mg cialis

  30. Pingback: cialis in canada

  31. Pingback: buy viagra 50 mg

  32. Pingback: viagra 75 mg

  33. Pingback: experienceleaguecommunities.adobe.com/t5/user/viewprofilepage/user-id/17881217

  34. Pingback: in.pinterest.com/vidalista80review/

  35. Pingback: dizain cheloveka

  36. Pingback: sulfatealbuterol.com

  37. Pingback: ivermectinus.com

  38. Pingback: human design

  39. Pingback: axbb.ru

  40. Pingback: cenforcemg.com

  41. Pingback: flagylzub.com

  42. Pingback: kmgra.com

  43. Pingback: lasixotc.com

  44. Pingback: stromectool.com

  45. Pingback: flagyltb.com

  46. Pingback: levitraoffer.net

  47. Pingback: priligy 30mg

  48. Pingback: tiktok

  49. Pingback: hyocimax s tablet uses

  50. Pingback: can i buy amoxicillin

  51. Pingback: nitrostat pill

  52. Pingback: ciprodex dosage

  53. Pingback: groups

  54. Pingback: cheapest viagra 50mg

  55. Pingback: amoxil for urinary tract infection

  56. Pingback: cialis online prices

  57. Pingback: purple viagra 100

  58. Pingback: prednisolone dose for asthma

  59. Pingback: blood pressure bystolic

  60. Pingback: amoxil capsule price

  61. Pingback: professorkorotkov.ru

  62. Pingback: viahelpmen.wordpress.com

  63. Pingback: psycholog-korotkov.ru

  64. Pingback: vermact plus

  65. Pingback: clomid for sale

  66. Pingback: psikhologvyalte.ru

  67. Pingback: clincitop gel buy online

  68. Pingback: besivance eye drop prices

  69. Pingback: buy assurans

  70. Pingback: here

  71. Pingback: caverta 25

  72. Pingback: super tadalista

  73. Pingback: kamagra uk

  74. Pingback: vidalista.pics

  75. Pingback: otclevitra.com

  76. Pingback: clomiphene Citrate

  77. Pingback: ekzistenczialnyj

  78. Pingback: Ïñèõîëîã, ïñèõîòåðàïåâò, ïñèõèàòð, ïñèõîàíàëèòèê

  79. Pingback: prednisone 20mg

  80. Pingback: clomid for sale

  81. Pingback: 75mg viagra

  82. Pingback: myprin92.ru

  83. Pingback: 0410.ru

  84. Pingback: atvip.ru

  85. Pingback: vigrakrs.com

  86. Pingback: why take latanoprost at night

  87. Pingback: sketchfab.com/female-cialis

  88. Pingback: 5yucMCMAAAAJ

  89. Pingback: instagram.com/korotkovlakanfreud

  90. Pingback: ofevinfo.wordpress.com

  91. Pingback: site

  92. Pingback: price of viagra per pill

  93. Pingback: samscainfo.wordpress.com

  94. Pingback: vidalforman.wordpress.com

  95. Pingback: Sochi-psiholog-Russia

  96. Pingback: who makes viagra pills

  97. Pingback: vardenafil 20mg

  98. Pingback: 100 mg viagra side effects

  99. Pingback: t.me/s/psy_chat_online

  100. Pingback: clomiphene 50mg ovulation

  101. Pingback: afinitor cost

  102. Pingback: Forum

  103. Pingback: fildena.homes

  104. Pingback: 439W6fo

  105. Pingback: psy

  106. Pingback: r2f.ru

  107. Pingback: xblx.ru

  108. Pingback: dilts.g-u.su

  109. Pingback: anatoliy-alekseyevich-derkach.ru

  110. Pingback: where to buy cheap toradol for sale

  111. Pingback: artane and coolock credit union

  112. Pingback: zanaflex for sciatica pain

  113. Pingback: cyproheptadine hydrochloride syrup ip side effects

  114. Pingback: street value of tizanidine 2mg

  115. Pingback: periactin sciroppo dosaggio

  116. Pingback: can you get generic ketorolac pills

  117. Pingback: baclofen compared to vicodin

  118. Pingback: azathioprine irregular heartbeat

  119. Pingback: maxalt wine

  120. Pingback: classe terapeutica piroxicam

  121. Pingback: how effective is meloxicam for pain

  122. Pingback: prospecto de lioresal

  123. Pingback: imdur pill

  124. Pingback: what are side effects of mobic

  125. Pingback: imuran proctitis

  126. Pingback: rizatriptan benzoate drug bank

  127. Pingback: can you take sumatriptan and paracetamol together

  128. Pingback: where can i buy generic pyridostigmine without dr prescription

  129. Pingback: diclofenac vs celebrex

  130. Pingback: cilostazol en insuficiencia cardiaca

  131. Pingback: can mebeverine be taken after food

  132. Pingback: indomethacin 75 sr

  133. Pingback: migraine injection imitrex

  134. Pingback: amitriptyline dose for sleep

  135. Pingback: mestinon tabs

  136. Pingback: elavil mgs

Leave a Comment