IDAutomation.com, Inc., Computers Hardware, Software & Services, Tampa, FL Contact IDAutomationView your cart in the IDAutomation Store  
Loading
Home > Barcode Components > JavaScript Barcode Generator > User Manual

JavaScript Generator User Manual Patented

Order the AJAX JavaScript Bar Code Generator Download Demo of AJAX JavaScript Bar Code Generator Support for the AJAX JavaScript Bar Code Generator

Product Overview

The Native JavaScript AJAX Barcode Generator is a script file that may be easily inserted into HTML and AJAX applications to create bar code images for display in HTML or text objects. Once implemented, no other components or fonts need to be installed to create barcodes; it is the complete barcode generator.

The Native Barcode Generator supports the following symbologies:

  • Codabar
  • Code 39
  • Code 128 Auto
  • Code 128 UCC/EAN
  • Code 128, Sets A, B and C
  • Interleaved 2 of 5
  • MSI
  • Postnet
  • PDF417 (in 2D version)
  • Data Matrix (in 2D version)

Barcode Integration Tutorial

Installing the Native JavaScript Barcode Generator is a fairly easy process. Several generators are provided for different bar code types.

  1. Extract the files from the installation package.
  2. Several generator files are provided for different barcode types. Use the file that represents the barcode type that is needed. If in doubt, IDAutomation recommends choosing Code 128 Auto, which is in the file named IDAutomation_JavaScriptBarcode_C128.js.
  3. Open the HTML document or application where the barcode is to be integrated.
  4. Add the following line at the top of the file just before the </head> line to load the appropriate JavaScript file:
    <script language="JavaScript" src="IDAutomation_JavaScriptBarcode_C128.js"></script>
  5. Add a script where the barcode is to appear in the HTML document or text object, which is the file name without the ".js":
    <script type="text/javascript">
    document.write(IDAutomation_JavaScriptBarcode_C128(DataToEncode))
    </script>
  6. Modify "DataToEncode" to equal what is to be encoded in the barcode. This may be accomplished with a variable or a dynamically generated webpage.
  7. Print the result to verify that the barcodes are created properly and that they can be read with a scanner. If a scanner is needed to verify barcodes, IDAutomation offers several affordable, barcode scanner kits.
  8. Additional properties may be modified if necessary.
  9. Print the result to verify barcodes are being properly created. Ensure the object has been sized properly to contain the entire barcode. If the width of the barcode is larger than the area for it, several white lines will appear.
    Truncated barcode object
  10. It is normal to view some horizontal lines and distortion of the barcode on the screen because of low screen resolution. However, the barcodes should be accurate when printed.
    AJAX JavaScript Barcode
    If white lines appear after printing, select a mono-spaced font such as Courier New or Lucida Console at 3 to 5 points for the text field where the barcode image is returned. Additionally, the line spacing property may need to be adjusted to equal .8 or .9 lines.

Properties and Symbology Options

All functions listed below are provided as a single JavaScript file preceded with IDAutomation_JavaScriptBarcode_.

  • Additional properties may be modified if necessary as a parameter; for example:
    IDAutomation_JavaScriptBarcode_C128("12345678",8,4,true)
  • For all functions below, the data type returned is a string formatted for HTML and the input type for DataToEncode is a string.
  • To return the barcode image only without HTML formatting commands, set XDimensionPoints to equal "0" and select a Unicode mono-spaced font such as Courier New or Lucida Console at 3 to 5 points for the text field where the barcode image is returned.

Barcode Functions

Function Notes
C128(DataToEncode, ApplyTilde, BarHeight, XDimensionPoints) This is a "Code 128 Auto" function that will automatically encode any data from ASCII 1 to ASCII 127. It will automatically switch to character set C to encode numbers as necessary. To encode alpha-numeric UCC/EAN-128, ASCII 202 or character is entered as the FNC1 before each AI. When any barcode begins with the FNC1, it automatically starts in Set C as required.
For example, the UCC number of (8100)712345(21)12WH5678 should be entered as a formula of: IDAutomation_JavaScriptBarcode_C128 ("╩8100712345╩2112WH5678",6,4,true)
or
IDAutomation_JavaScriptBarcode_C128 ("╩" & [Table1.DataField1] & "╩" & [Table1.DataField2],6,4,true)
More information about AI's and UCC/EAN-128 is located here.

If ApplyTilde is set to True, the tilde will be processed. ApplyTilde is False by default in this function.

C128HR(DataToEncode, ApplyTilde) If creating Code 128 barcodes which need the text formatted, use this function. It is generally only used to format the text for UCC/EAN barcodes according to IDAutomation's Code128 Barcode FAQ. For example:
IDAutomation_JavaScriptBarcode_C128HR ("╩" & "8100712345" & "╩" & "2112345678",true)

If ApplyTilde is set to True, the tilde will be processed. ApplyTilde is True by default in this function.

C128a(DataToEncode, BarHeight, XDimensionPoints) Formats output to set A of Code-128. Use caution with this option because any lowercase character creates a function. Use the letter "i" for a tab and "m" for a return. For most purposes, it is better to use the C128() function instead of this one.
C128b(DataToEncode, BarHeight, XDimensionPoints) Formats output to Code-128, character set B. For most purposes, it is better to use the C128() function instead of this one.
C128c(DataToEncode, BarHeight, XDimensionPoints) This code128 function "interleaves" even numbers into pairs for high density. An even number of digits is required. For most purposes, it is better to use the C128() function.
C39(DataToEncode, IncludeCheckDigit, N_Dimension, BarHeight, XDimensionPoints) A MOD 43 checksum will be calculated if IncludeCheckDigit is true. For example: IDAutomation_JavaScriptBarcode_C39 ("123456789", 8, 3, 3, true)
Codabar(DataToEncode, N_Dimension, StartChar, StopChar, BarHeight, XDimensionPoints) StartChar and StopChar are also required as the start and stop characters. Valid start and stop characters are A, B, C and D.
I2of5(DataToEncode, IncludeCheckDigit, N_Dimension, BarHeight, XDimensionPoints) An even number of digits is required. A MOD 10 checksum will be calculated if IncludeCheckDigit is true.
MSI(DataToEncode, IncludeCheckDigit, N_Dimension, BarHeight, XDimensionPoints) Formats output for bar-coding in the MSI/Plessey symbology. A MOD 10 checksum will be calculated if IncludeCheckDigit is true.
Postnet(DataToEncode, IncludeCheckDigit, XDimensionPoints) DataToEncode is a single string of Zip, Zip + 4 or Zip + 4 + Delivery Point. A MOD 10 checksum will be calculated if IncludeCheckDigit is true.
DataMatrix(DataToEncode, ApplyTilde, EncodingMode, PreferredFormat, XDimensionPoints) ApplyTilde is a Boolean value that sets the tilde functionality for Data Matrix, default is false. EncodingMode sets the mode for encoding the data, 0 = Base 256, 1 = C40, 2 = Text, 3 = ASCII, default is 0. PreferredFormat sets the preferred size of the barcode.
PDF417(DataToEncode, ApplyTilde, EccLevel, ColumnSpecify, RowSpecify, Truncate, ForceBinary, XDimensionPoints) ApplyTilde is a Boolean value that set the tilde functionality for PDF417, default is false. EccLevel sets the error correction level. ColumnSpecify and RowSpecify set the number of rows and columns in the barcode, if both are specified, then RowSpecify is ignored; default is automatic. Truncate is a Boolean value; if set to true, the right side of the symbol is removed. ForceBinary is a Boolean, when true the encoding is in binary, otherwise the symbol is encoded in Text mode.
UCC/EAN-128 Barcode Examples for encoding UCC/EAN-128 Barcodes:
USPS EAN128 The following formula will create USPS_EAN128 in Code 128:
IDAutomation_JavaScriptBarcode_C128 ("╩" & "912312214123442441134" & "~m19", 8, 4, true
Where the number of 912312214123442441134 may be replaced with a data field, for example:
IDAutomation_JavaScriptBarcode_C128 ("╩" & [Table1.DataField1] & "~m19", 8, 4, true)
This number encoded is made up of the following: 2 digit service code + 9 digit customer ID + 8 digit sequential package ID + MOD 10 check digit. For more information, refer to the USPS portion of the Code 128 FAQ and the UCC/EAN portion of the Code128 Barcode FAQ.
SCC14 The following formula will create SCC14 in Code 128:
IDAutomation_JavaScriptBarcode_C128 ("╩" & "013001234567890" & "~m13", 8, 4, true)
For more information, refer to the UCC/EAN portion of IDAutomation's Code128 Barcode FAQ.
SSCC18 The following formula will create SCC18 in Code 128:
IDAutomation_JavaScriptBarcode_C128 ("╩" & "0000801234999999999" & "~m17", 8, 4, true)
For more information, refer to the UCC/EAN portion of IDAutomation's Code128 Barcode FAQ.
In-depth description of certain functions:
  • DataToEncode - This string value represents the data being encoded.
  • BarHeight - The height of the bars in the symbol; default = 8, which is about .3 inches or 1 CM. The approximate height is determined with the following formula:
    Height in Inches = (Font Size) * (BarHeight) * 0.015
    Height in CM    = (Font Size) * (BarHeight) * 0.04
  • XDimensionPoints - The X dimension or barcode width is determined by setting the point size. The point size must be small, generally 3 to 5 points. The default setting is 4 points. When XDimensionPoints equals "0", only the barcode image is returned without any HTML formatting. When this is the case, the portion of the document where the image is placed must have a Unicode mono-spaced font selected with the appropriate point size setting.
    Point Size Approximate X Dimension
     2  08 Mils
     3  12 Mils
     4  16 Mils
     5  20 Mils
     6  24 Mils
     7  28 Mils
     8  32 Mils
  • N_Dimension - Determines the width of the wide bars, which is a multiple of the X dimension. Valid values are 2 and 3. The default is 2.
  • IncludeCheckDigit - A Boolean value that determines whether a check digit should be automatically calculated and included for the DataToEncode.
  • ApplyTilde - In Code 128 AUTO and UCC128, if the ApplyTilde option is set to True, the tilde will be processed and allow the following encoding options:
    • ASCII characters: The format ~ddd may be used to specify the ASCII code of the character to be encoded. For example, if entering the following text in the Data field: 66~02977 it will actually encode 66GS77 where GS is a delimiter ASCII 29 character. Other commonly used ASCII codes are ~009 for a tab and ~013 which is a return function. To encode other functions, please refer to IDAutomation's ASCII chart.
    • Encoding UCC/EAN-128: To encode alpha-numeric UCC/EAN128, the character must be set to "AUTO" for automatic. Then, ASCII 202 or character ╩ is entered as the FNC1 before each AI and the required start C is included automatically. For example, the UCC number of (8100)712345(21)12WH5678 should be entered as: 81007123452112WH5678. In most cases, the AI's will be properly represented in the human readable text. If the parenthesis is not around the correct number for the AI, enter the following extended ASCII character as the FNC1 for the correct number of digits in the AI:
          ASCII 212 = 2 digits    ASCII 215 = 5 digits
          ASCII 213 = 3 digits    ASCII 216 = 6 digits
          ASCII 214 = 4 digits    ASCII 217 = 7 digits

      For example, to encode (1277)56, enter Í127756. For more information, please refer to the UCC/EAN 128 section of IDAutomation's Code 128 FAQ
    • Create a Mod 10 Check digit: To create a Mod 10 check digit for xx number of characters, add the following to the DataToEncode: ~mnn (where nn is a 2 digit number representing the number of characters preceding the tilde in which to base the Mod 10 calculation). The additional MOD 10 check digit is commonly used in UCC or EAN barcode types. For example, setting the DataToEncode property to ╩4021234567890123456~m16 will cause a mod 10 check digit to be created based on all 16 characters before the tilde. The human readable text and scanned data will display as (402)12345678901234560. The final 0 is the mod 10 check digit and replaces ~m16.
    • FNC2: When necessary, the FNC2 character may be inserted into the DataToEncode string by using ASCII 197. For example; 8012349091. IDAutomation's SC5USB Scanner can be programmed to hold the barcode starting with the FNC2 in memory and only transmit it to the computer after scanning a barcode containing the FNC1.

Technical Support

Support for the AJAX JavaScript Bar Code GeneratorCommon Problems and Solutions:

  • If scanning problems are encountered, verify a printer of 600 DPI or greater is being used. A large point size such as 5 points must be used with low-resolution printers. IDAutomation also offers many barcode fonts that print well to low-resolution printers.
  • When not being used in HTML applications, the barcode image may be displayed in a text box or field. In this case, the font selected for the text object should be "Courier New", "Lucida Console" or another mono-spaced unicode font at 3 to 5 points.
  • Ensure the barcode can fit in the object. If the width of the barcode is larger than the object, several white lines will appear.
    Truncated JavaScript barcode object
  • Some web browsers such as Opera may not allow very small font point sizes to be used. Therefore, the barcode image for these browsers will be displayed at the smallest allowed size, usually 8 points. Additional height and width may be needed to properly display images in this situation. This does not appear to be an issue with Internet Explorer, Mozilla Firefox and Netscape browsers.
  • Additional problems and solutions are provided at IDAutomation's support site and by searching resolved public forum issues. Priority phone, email and forum support is provided up to 30 days after purchase. Additional priority phone, email and forum support may be obtained if the Priority Support and Upgrade Subscription is active.

Related Barcode Software Products

IDAutomation.com also provides several other barcode products for easy integration with Web Applications. A few of these products include:

Additional products that may be of interest:

If a scanner is needed to verify barcodes, IDAutomation also provides several hand-held USB scanners.

Back to Top

 © Copyright 2014 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.