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!

143 Comments

  1. Pingback: buy cialis 5mg online

  2. Pingback: 50mg viagra price

  3. Pingback: eli lilly cialis

  4. Pingback: cialis tablet

  5. Pingback: sildenafil citrate 50mg tablets

  6. Pingback: real viagra 100mg

  7. Pingback: sildenafil 25 mg online

  8. Pingback: wikinlp

  9. Pingback: wikinlp.ru

  10. Pingback: cialis 5 mg

  11. Pingback: cialis tadalafil

  12. Pingback: generique viagra

  13. Pingback: The Creator Causal Design

  14. Pingback: Lider

  15. Pingback: dizain-cheloveka-manifestor.ru

  16. Pingback: hdmy.ru

  17. Pingback: HumanDesign2028.ru

  18. Pingback: cenforce 200

  19. Pingback: buy cenforce 200 mg online

  20. Pingback: vardenafil

  21. Pingback: canadian pharmacy in tampa fl

  22. Pingback: where can i buy Azithromycin

  23. Pingback: cost of clomid without prescription

  24. Pingback: kamagra usa ban

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

  26. Pingback: lasix 100mg over the counter

  27. Pingback: Ventolin inhaler how often to use

  28. Pingback: buy viagra online

  29. Pingback: ivecop tablet

  30. Pingback: buy priligy paypal

  31. Pingback: androgel 1.0

  32. Pingback: my canadian pharmacy reviews

  33. Pingback: youtube-videos

  34. Pingback: viagra pfizer 50 mg

  35. Pingback: no presciption cialis

  36. Pingback: 60 mg cialis

  37. Pingback: cialis in canada

  38. Pingback: buy viagra 50 mg

  39. Pingback: viagra 75 mg

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

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

  42. Pingback: dizain cheloveka

  43. Pingback: sulfatealbuterol.com

  44. Pingback: ivermectinus.com

  45. Pingback: human design

  46. Pingback: axbb.ru

  47. Pingback: cenforcemg.com

  48. Pingback: flagylzub.com

  49. Pingback: kmgra.com

  50. Pingback: lasixotc.com

  51. Pingback: stromectool.com

  52. Pingback: flagyltb.com

  53. Pingback: levitraoffer.net

  54. Pingback: priligy 30mg

  55. Pingback: tiktok

  56. Pingback: hyocimax s tablet uses

  57. Pingback: can i buy amoxicillin

  58. Pingback: nitrostat pill

  59. Pingback: ciprodex dosage

  60. Pingback: groups

  61. Pingback: cheapest viagra 50mg

  62. Pingback: amoxil for urinary tract infection

  63. Pingback: cialis online prices

  64. Pingback: purple viagra 100

  65. Pingback: prednisolone dose for asthma

  66. Pingback: blood pressure bystolic

  67. Pingback: amoxil capsule price

  68. Pingback: professorkorotkov.ru

  69. Pingback: viahelpmen.wordpress.com

  70. Pingback: psycholog-korotkov.ru

  71. Pingback: vermact plus

  72. Pingback: clomid for sale

  73. Pingback: psikhologvyalte.ru

  74. Pingback: clincitop gel buy online

  75. Pingback: besivance eye drop prices

  76. Pingback: buy assurans

  77. Pingback: here

  78. Pingback: caverta 25

  79. Pingback: super tadalista

  80. Pingback: kamagra uk

  81. Pingback: vidalista.pics

  82. Pingback: otclevitra.com

  83. Pingback: clomiphene Citrate

  84. Pingback: ekzistenczialnyj

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

  86. Pingback: prednisone 20mg

  87. Pingback: clomid for sale

  88. Pingback: 75mg viagra

  89. Pingback: myprin92.ru

  90. Pingback: 0410.ru

  91. Pingback: atvip.ru

  92. Pingback: vigrakrs.com

  93. Pingback: why take latanoprost at night

  94. Pingback: sketchfab.com/female-cialis

  95. Pingback: 5yucMCMAAAAJ

  96. Pingback: instagram.com/korotkovlakanfreud

  97. Pingback: ofevinfo.wordpress.com

  98. Pingback: site

  99. Pingback: price of viagra per pill

  100. Pingback: samscainfo.wordpress.com

  101. Pingback: vidalforman.wordpress.com

  102. Pingback: Sochi-psiholog-Russia

  103. Pingback: who makes viagra pills

  104. Pingback: vardenafil 20mg

  105. Pingback: 100 mg viagra side effects

  106. Pingback: t.me/s/psy_chat_online

  107. Pingback: clomiphene 50mg ovulation

  108. Pingback: afinitor cost

  109. Pingback: Forum

  110. Pingback: fildena.homes

  111. Pingback: 439W6fo

  112. Pingback: psy

  113. Pingback: r2f.ru

  114. Pingback: xblx.ru

  115. Pingback: dilts.g-u.su

  116. Pingback: anatoliy-alekseyevich-derkach.ru

  117. Pingback: where to buy cheap toradol for sale

  118. Pingback: artane and coolock credit union

  119. Pingback: zanaflex for sciatica pain

  120. Pingback: cyproheptadine hydrochloride syrup ip side effects

  121. Pingback: street value of tizanidine 2mg

  122. Pingback: periactin sciroppo dosaggio

  123. Pingback: can you get generic ketorolac pills

  124. Pingback: baclofen compared to vicodin

  125. Pingback: azathioprine irregular heartbeat

  126. Pingback: maxalt wine

  127. Pingback: classe terapeutica piroxicam

  128. Pingback: how effective is meloxicam for pain

  129. Pingback: prospecto de lioresal

  130. Pingback: imdur pill

  131. Pingback: what are side effects of mobic

  132. Pingback: imuran proctitis

  133. Pingback: rizatriptan benzoate drug bank

  134. Pingback: can you take sumatriptan and paracetamol together

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

  136. Pingback: diclofenac vs celebrex

  137. Pingback: cilostazol en insuficiencia cardiaca

  138. Pingback: can mebeverine be taken after food

  139. Pingback: indomethacin 75 sr

  140. Pingback: migraine injection imitrex

  141. Pingback: amitriptyline dose for sleep

  142. Pingback: mestinon tabs

  143. Pingback: elavil mgs

Leave a Comment