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!

168 Comments

  1. Pingback: Cognitive

  2. Pingback: Cognitive warfare

  3. Pingback: Online psychologist

  4. Pingback: Single-Session

  5. Pingback: psiholog-psiholog-onlajn

  6. Pingback: Q141974782

  7. Pingback: archive

  8. Pingback: Carl Gustav Jung

  9. Pingback: structure-of-legal-norms

  10. Pingback: management

  11. Pingback: yalta

  12. Pingback: âåëèêèå öèòàòû

  13. Pingback: Öèòàòû

  14. Pingback: Öèòàòû âåëèêèõ ëþäåé

  15. Pingback: Freid

  16. Pingback: Psychoanalyst

  17. Pingback: 100 tsitat velikikh lyudey

  18. Pingback: logician-philosophy

  19. Pingback: 7s son solntse seks sport spirt

  20. Pingback: Coaching

  21. Pingback: link

  22. Pingback: psychologist

  23. Pingback: best real money online casino

  24. Pingback: online

  25. Pingback: psy.w-495.ru

  26. Pingback: buy cialis 5mg online

  27. Pingback: 50mg viagra price

  28. Pingback: eli lilly cialis

  29. Pingback: cialis tablet

  30. Pingback: sildenafil citrate 50mg tablets

  31. Pingback: real viagra 100mg

  32. Pingback: sildenafil 25 mg online

  33. Pingback: wikinlp

  34. Pingback: wikinlp.ru

  35. Pingback: cialis 5 mg

  36. Pingback: cialis tadalafil

  37. Pingback: generique viagra

  38. Pingback: The Creator Causal Design

  39. Pingback: Lider

  40. Pingback: dizain-cheloveka-manifestor.ru

  41. Pingback: hdmy.ru

  42. Pingback: HumanDesign2028.ru

  43. Pingback: cenforce 200

  44. Pingback: buy cenforce 200 mg online

  45. Pingback: vardenafil

  46. Pingback: canadian pharmacy in tampa fl

  47. Pingback: where can i buy Azithromycin

  48. Pingback: cost of clomid without prescription

  49. Pingback: kamagra usa ban

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

  51. Pingback: lasix 100mg over the counter

  52. Pingback: Ventolin inhaler how often to use

  53. Pingback: buy viagra online

  54. Pingback: ivecop tablet

  55. Pingback: buy priligy paypal

  56. Pingback: androgel 1.0

  57. Pingback: my canadian pharmacy reviews

  58. Pingback: youtube-videos

  59. Pingback: viagra pfizer 50 mg

  60. Pingback: no presciption cialis

  61. Pingback: 60 mg cialis

  62. Pingback: cialis in canada

  63. Pingback: buy viagra 50 mg

  64. Pingback: viagra 75 mg

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

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

  67. Pingback: dizain cheloveka

  68. Pingback: sulfatealbuterol.com

  69. Pingback: ivermectinus.com

  70. Pingback: human design

  71. Pingback: axbb.ru

  72. Pingback: cenforcemg.com

  73. Pingback: flagylzub.com

  74. Pingback: kmgra.com

  75. Pingback: lasixotc.com

  76. Pingback: stromectool.com

  77. Pingback: flagyltb.com

  78. Pingback: levitraoffer.net

  79. Pingback: priligy 30mg

  80. Pingback: tiktok

  81. Pingback: hyocimax s tablet uses

  82. Pingback: can i buy amoxicillin

  83. Pingback: nitrostat pill

  84. Pingback: ciprodex dosage

  85. Pingback: groups

  86. Pingback: cheapest viagra 50mg

  87. Pingback: amoxil for urinary tract infection

  88. Pingback: cialis online prices

  89. Pingback: purple viagra 100

  90. Pingback: prednisolone dose for asthma

  91. Pingback: blood pressure bystolic

  92. Pingback: amoxil capsule price

  93. Pingback: professorkorotkov.ru

  94. Pingback: viahelpmen.wordpress.com

  95. Pingback: psycholog-korotkov.ru

  96. Pingback: vermact plus

  97. Pingback: clomid for sale

  98. Pingback: psikhologvyalte.ru

  99. Pingback: clincitop gel buy online

  100. Pingback: besivance eye drop prices

  101. Pingback: buy assurans

  102. Pingback: here

  103. Pingback: caverta 25

  104. Pingback: super tadalista

  105. Pingback: kamagra uk

  106. Pingback: vidalista.pics

  107. Pingback: otclevitra.com

  108. Pingback: clomiphene Citrate

  109. Pingback: ekzistenczialnyj

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

  111. Pingback: prednisone 20mg

  112. Pingback: clomid for sale

  113. Pingback: 75mg viagra

  114. Pingback: myprin92.ru

  115. Pingback: 0410.ru

  116. Pingback: atvip.ru

  117. Pingback: vigrakrs.com

  118. Pingback: why take latanoprost at night

  119. Pingback: sketchfab.com/female-cialis

  120. Pingback: 5yucMCMAAAAJ

  121. Pingback: instagram.com/korotkovlakanfreud

  122. Pingback: ofevinfo.wordpress.com

  123. Pingback: site

  124. Pingback: price of viagra per pill

  125. Pingback: samscainfo.wordpress.com

  126. Pingback: vidalforman.wordpress.com

  127. Pingback: Sochi-psiholog-Russia

  128. Pingback: who makes viagra pills

  129. Pingback: vardenafil 20mg

  130. Pingback: 100 mg viagra side effects

  131. Pingback: t.me/s/psy_chat_online

  132. Pingback: clomiphene 50mg ovulation

  133. Pingback: afinitor cost

  134. Pingback: Forum

  135. Pingback: fildena.homes

  136. Pingback: 439W6fo

  137. Pingback: psy

  138. Pingback: r2f.ru

  139. Pingback: xblx.ru

  140. Pingback: dilts.g-u.su

  141. Pingback: anatoliy-alekseyevich-derkach.ru

  142. Pingback: where to buy cheap toradol for sale

  143. Pingback: artane and coolock credit union

  144. Pingback: zanaflex for sciatica pain

  145. Pingback: cyproheptadine hydrochloride syrup ip side effects

  146. Pingback: street value of tizanidine 2mg

  147. Pingback: periactin sciroppo dosaggio

  148. Pingback: can you get generic ketorolac pills

  149. Pingback: baclofen compared to vicodin

  150. Pingback: azathioprine irregular heartbeat

  151. Pingback: maxalt wine

  152. Pingback: classe terapeutica piroxicam

  153. Pingback: how effective is meloxicam for pain

  154. Pingback: prospecto de lioresal

  155. Pingback: imdur pill

  156. Pingback: what are side effects of mobic

  157. Pingback: imuran proctitis

  158. Pingback: rizatriptan benzoate drug bank

  159. Pingback: can you take sumatriptan and paracetamol together

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

  161. Pingback: diclofenac vs celebrex

  162. Pingback: cilostazol en insuficiencia cardiaca

  163. Pingback: can mebeverine be taken after food

  164. Pingback: indomethacin 75 sr

  165. Pingback: migraine injection imitrex

  166. Pingback: amitriptyline dose for sleep

  167. Pingback: mestinon tabs

  168. Pingback: elavil mgs

Leave a Comment