SourceForge Project Page

Code 39

also known as: USD-3, 3 of 9 code

Example

Example Cod 39 symbol

Structure

The configuration for the default implementation is:

<barcode>
  <code39>
      <height>{length:15mm}</height>
      <module-width>{length:0.19mm}</module-width>
      <wide-factor>{number:2.5}</wide-factor>
      <interchar-gap-width>{length:1mw}</interchar-gap-width>
      <quiet-zone enabled="{boolean:true}">{length:10mw}</quiet-zone>
      <checksum>{checksum-mode:auto=ignore}</checksum>
      <extended-charset>{boolean:false}</extended-charset>
      <human-readable>
        <placement>{human-readable-placement:bottom}</placement>
        <font-name>{font-name:Helvetica}</font-name>
        <font-size>{length:8pt}</font-size>
        <display-start-stop>{boolean:false}</display-start-stop>
        <display-checksum>{boolean:false}</display-checksum>
      </human-readable>
  </code39>
</barcode>

Notes

  • The height should be at least 0.15 times the barcode's length or 0.25 inches.
  • The module width (width of narrow element) should be at least 7.5 mils (a mil is 1/1000 inch) or 0.19mm.
  • The multiple for the wide element should be between 2.0 and 3.0 if the narrow element is greater than 20 mils. If the narrow element is less than 20 mils, the multiple can only range between 2.0 and 2.2.
  • Quiet zones must be at least 10 times the module width or 0.10 inches, whichever is larger.
  • The intercharacter gap width (igw) is 5.3 times the module width (mw) if mw is less than 10 mils. If mw is 10 mils or greater, the value for igw is 3mw or 53 mils, whichever is greater. However, for quality printers, igw often equals mw.

Message format

  • Valid characters are 0-9, A-Z and the characters: - . $ / + % SPACE
  • To enable support for all US-ASCII (7-bit) characters, set "extended-charset" to "true".
  • The character '*' is only used as start and stop character and may not be used in the message (unless the extended character set is enabled). The '*' character is automatically added before and after the message even though you may not see it in the human-readable part. (See also "display-start-stop" and "display-checksum" values)
  • display-start-stop controls whether the start and stop characters should be included in the human-readable part. Setting display-start-stop to true, automatically sets display-checksum to true, too. Note: this option is ignored if the extended character set is enabled!
  • display-checksum controls whether the calculated checksum should be included in the human-readable part. Note: this option is ignored if the extended character set is enabled!