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!

135 Comments

  1. Pingback: wikinlp.ru

  2. Pingback: cialis 5 mg

  3. Pingback: cialis tadalafil

  4. Pingback: generique viagra

  5. Pingback: The Creator Causal Design

  6. Pingback: Lider

  7. Pingback: dizain-cheloveka-manifestor.ru

  8. Pingback: hdmy.ru

  9. Pingback: HumanDesign2028.ru

  10. Pingback: cenforce 200

  11. Pingback: buy cenforce 200 mg online

  12. Pingback: vardenafil

  13. Pingback: canadian pharmacy in tampa fl

  14. Pingback: where can i buy Azithromycin

  15. Pingback: cost of clomid without prescription

  16. Pingback: kamagra usa ban

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

  18. Pingback: lasix 100mg over the counter

  19. Pingback: Ventolin inhaler how often to use

  20. Pingback: buy viagra online

  21. Pingback: ivecop tablet

  22. Pingback: buy priligy paypal

  23. Pingback: androgel 1.0

  24. Pingback: my canadian pharmacy reviews

  25. Pingback: youtube-videos

  26. Pingback: viagra pfizer 50 mg

  27. Pingback: no presciption cialis

  28. Pingback: 60 mg cialis

  29. Pingback: cialis in canada

  30. Pingback: buy viagra 50 mg

  31. Pingback: viagra 75 mg

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

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

  34. Pingback: dizain cheloveka

  35. Pingback: sulfatealbuterol.com

  36. Pingback: ivermectinus.com

  37. Pingback: human design

  38. Pingback: axbb.ru

  39. Pingback: cenforcemg.com

  40. Pingback: flagylzub.com

  41. Pingback: kmgra.com

  42. Pingback: lasixotc.com

  43. Pingback: stromectool.com

  44. Pingback: flagyltb.com

  45. Pingback: levitraoffer.net

  46. Pingback: priligy 30mg

  47. Pingback: tiktok

  48. Pingback: hyocimax s tablet uses

  49. Pingback: can i buy amoxicillin

  50. Pingback: nitrostat pill

  51. Pingback: ciprodex dosage

  52. Pingback: groups

  53. Pingback: cheapest viagra 50mg

  54. Pingback: amoxil for urinary tract infection

  55. Pingback: cialis online prices

  56. Pingback: purple viagra 100

  57. Pingback: prednisolone dose for asthma

  58. Pingback: blood pressure bystolic

  59. Pingback: amoxil capsule price

  60. Pingback: professorkorotkov.ru

  61. Pingback: viahelpmen.wordpress.com

  62. Pingback: psycholog-korotkov.ru

  63. Pingback: vermact plus

  64. Pingback: clomid for sale

  65. Pingback: psikhologvyalte.ru

  66. Pingback: clincitop gel buy online

  67. Pingback: besivance eye drop prices

  68. Pingback: buy assurans

  69. Pingback: here

  70. Pingback: caverta 25

  71. Pingback: super tadalista

  72. Pingback: kamagra uk

  73. Pingback: vidalista.pics

  74. Pingback: otclevitra.com

  75. Pingback: clomiphene Citrate

  76. Pingback: ekzistenczialnyj

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

  78. Pingback: prednisone 20mg

  79. Pingback: clomid for sale

  80. Pingback: 75mg viagra

  81. Pingback: myprin92.ru

  82. Pingback: 0410.ru

  83. Pingback: atvip.ru

  84. Pingback: vigrakrs.com

  85. Pingback: why take latanoprost at night

  86. Pingback: sketchfab.com/female-cialis

  87. Pingback: 5yucMCMAAAAJ

  88. Pingback: instagram.com/korotkovlakanfreud

  89. Pingback: ofevinfo.wordpress.com

  90. Pingback: site

  91. Pingback: price of viagra per pill

  92. Pingback: samscainfo.wordpress.com

  93. Pingback: vidalforman.wordpress.com

  94. Pingback: Sochi-psiholog-Russia

  95. Pingback: who makes viagra pills

  96. Pingback: vardenafil 20mg

  97. Pingback: 100 mg viagra side effects

  98. Pingback: t.me/s/psy_chat_online

  99. Pingback: clomiphene 50mg ovulation

  100. Pingback: afinitor cost

  101. Pingback: Forum

  102. Pingback: fildena.homes

  103. Pingback: 439W6fo

  104. Pingback: psy

  105. Pingback: r2f.ru

  106. Pingback: xblx.ru

  107. Pingback: dilts.g-u.su

  108. Pingback: anatoliy-alekseyevich-derkach.ru

  109. Pingback: where to buy cheap toradol for sale

  110. Pingback: artane and coolock credit union

  111. Pingback: zanaflex for sciatica pain

  112. Pingback: cyproheptadine hydrochloride syrup ip side effects

  113. Pingback: street value of tizanidine 2mg

  114. Pingback: periactin sciroppo dosaggio

  115. Pingback: can you get generic ketorolac pills

  116. Pingback: baclofen compared to vicodin

  117. Pingback: azathioprine irregular heartbeat

  118. Pingback: maxalt wine

  119. Pingback: classe terapeutica piroxicam

  120. Pingback: how effective is meloxicam for pain

  121. Pingback: prospecto de lioresal

  122. Pingback: imdur pill

  123. Pingback: what are side effects of mobic

  124. Pingback: imuran proctitis

  125. Pingback: rizatriptan benzoate drug bank

  126. Pingback: can you take sumatriptan and paracetamol together

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

  128. Pingback: diclofenac vs celebrex

  129. Pingback: cilostazol en insuficiencia cardiaca

  130. Pingback: can mebeverine be taken after food

  131. Pingback: indomethacin 75 sr

  132. Pingback: migraine injection imitrex

  133. Pingback: amitriptyline dose for sleep

  134. Pingback: mestinon tabs

  135. Pingback: elavil mgs

Leave a Comment