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!

144 Comments

  1. Pingback: psy.w-495.ru

  2. Pingback: buy cialis 5mg online

  3. Pingback: 50mg viagra price

  4. Pingback: eli lilly cialis

  5. Pingback: cialis tablet

  6. Pingback: sildenafil citrate 50mg tablets

  7. Pingback: real viagra 100mg

  8. Pingback: sildenafil 25 mg online

  9. Pingback: wikinlp

  10. Pingback: wikinlp.ru

  11. Pingback: cialis 5 mg

  12. Pingback: cialis tadalafil

  13. Pingback: generique viagra

  14. Pingback: The Creator Causal Design

  15. Pingback: Lider

  16. Pingback: dizain-cheloveka-manifestor.ru

  17. Pingback: hdmy.ru

  18. Pingback: HumanDesign2028.ru

  19. Pingback: cenforce 200

  20. Pingback: buy cenforce 200 mg online

  21. Pingback: vardenafil

  22. Pingback: canadian pharmacy in tampa fl

  23. Pingback: where can i buy Azithromycin

  24. Pingback: cost of clomid without prescription

  25. Pingback: kamagra usa ban

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

  27. Pingback: lasix 100mg over the counter

  28. Pingback: Ventolin inhaler how often to use

  29. Pingback: buy viagra online

  30. Pingback: ivecop tablet

  31. Pingback: buy priligy paypal

  32. Pingback: androgel 1.0

  33. Pingback: my canadian pharmacy reviews

  34. Pingback: youtube-videos

  35. Pingback: viagra pfizer 50 mg

  36. Pingback: no presciption cialis

  37. Pingback: 60 mg cialis

  38. Pingback: cialis in canada

  39. Pingback: buy viagra 50 mg

  40. Pingback: viagra 75 mg

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

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

  43. Pingback: dizain cheloveka

  44. Pingback: sulfatealbuterol.com

  45. Pingback: ivermectinus.com

  46. Pingback: human design

  47. Pingback: axbb.ru

  48. Pingback: cenforcemg.com

  49. Pingback: flagylzub.com

  50. Pingback: kmgra.com

  51. Pingback: lasixotc.com

  52. Pingback: stromectool.com

  53. Pingback: flagyltb.com

  54. Pingback: levitraoffer.net

  55. Pingback: priligy 30mg

  56. Pingback: tiktok

  57. Pingback: hyocimax s tablet uses

  58. Pingback: can i buy amoxicillin

  59. Pingback: nitrostat pill

  60. Pingback: ciprodex dosage

  61. Pingback: groups

  62. Pingback: cheapest viagra 50mg

  63. Pingback: amoxil for urinary tract infection

  64. Pingback: cialis online prices

  65. Pingback: purple viagra 100

  66. Pingback: prednisolone dose for asthma

  67. Pingback: blood pressure bystolic

  68. Pingback: amoxil capsule price

  69. Pingback: professorkorotkov.ru

  70. Pingback: viahelpmen.wordpress.com

  71. Pingback: psycholog-korotkov.ru

  72. Pingback: vermact plus

  73. Pingback: clomid for sale

  74. Pingback: psikhologvyalte.ru

  75. Pingback: clincitop gel buy online

  76. Pingback: besivance eye drop prices

  77. Pingback: buy assurans

  78. Pingback: here

  79. Pingback: caverta 25

  80. Pingback: super tadalista

  81. Pingback: kamagra uk

  82. Pingback: vidalista.pics

  83. Pingback: otclevitra.com

  84. Pingback: clomiphene Citrate

  85. Pingback: ekzistenczialnyj

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

  87. Pingback: prednisone 20mg

  88. Pingback: clomid for sale

  89. Pingback: 75mg viagra

  90. Pingback: myprin92.ru

  91. Pingback: 0410.ru

  92. Pingback: atvip.ru

  93. Pingback: vigrakrs.com

  94. Pingback: why take latanoprost at night

  95. Pingback: sketchfab.com/female-cialis

  96. Pingback: 5yucMCMAAAAJ

  97. Pingback: instagram.com/korotkovlakanfreud

  98. Pingback: ofevinfo.wordpress.com

  99. Pingback: site

  100. Pingback: price of viagra per pill

  101. Pingback: samscainfo.wordpress.com

  102. Pingback: vidalforman.wordpress.com

  103. Pingback: Sochi-psiholog-Russia

  104. Pingback: who makes viagra pills

  105. Pingback: vardenafil 20mg

  106. Pingback: 100 mg viagra side effects

  107. Pingback: t.me/s/psy_chat_online

  108. Pingback: clomiphene 50mg ovulation

  109. Pingback: afinitor cost

  110. Pingback: Forum

  111. Pingback: fildena.homes

  112. Pingback: 439W6fo

  113. Pingback: psy

  114. Pingback: r2f.ru

  115. Pingback: xblx.ru

  116. Pingback: dilts.g-u.su

  117. Pingback: anatoliy-alekseyevich-derkach.ru

  118. Pingback: where to buy cheap toradol for sale

  119. Pingback: artane and coolock credit union

  120. Pingback: zanaflex for sciatica pain

  121. Pingback: cyproheptadine hydrochloride syrup ip side effects

  122. Pingback: street value of tizanidine 2mg

  123. Pingback: periactin sciroppo dosaggio

  124. Pingback: can you get generic ketorolac pills

  125. Pingback: baclofen compared to vicodin

  126. Pingback: azathioprine irregular heartbeat

  127. Pingback: maxalt wine

  128. Pingback: classe terapeutica piroxicam

  129. Pingback: how effective is meloxicam for pain

  130. Pingback: prospecto de lioresal

  131. Pingback: imdur pill

  132. Pingback: what are side effects of mobic

  133. Pingback: imuran proctitis

  134. Pingback: rizatriptan benzoate drug bank

  135. Pingback: can you take sumatriptan and paracetamol together

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

  137. Pingback: diclofenac vs celebrex

  138. Pingback: cilostazol en insuficiencia cardiaca

  139. Pingback: can mebeverine be taken after food

  140. Pingback: indomethacin 75 sr

  141. Pingback: migraine injection imitrex

  142. Pingback: amitriptyline dose for sleep

  143. Pingback: mestinon tabs

  144. Pingback: elavil mgs

Leave a Comment