# Barcode Object Reference

In the DocServicesAPI ExpereAPI DocumentServiceAPI, barcodes are implemented through the use of the Ancillary Output option and defined through a single object, Barcode, containing a string parameter to define the value(s) of the barcode and an set of enumerated values defining the type of barcode to implement.
Note: In addition to defining the barcode through a pattern string on the request, you can include document metadata in a barcode through custom data defined on the Package Rules tab in the Requirements Editor as part of document authoring. See Implementing Barcodes with Custom Data (Package Rules).
A visual representation of the Barcode object looks like:

- Barcode: This object takes a Barcode Type object and a string parameter, Pattern.
- Pattern: This string is used to create the value of the barcode. The string can contain text to place in the barcode and any of the following substitution parameters (these are described in more detail in the Barcode Types (Fonts) and Patterns Barcode Types (Fonts) and Patterns section):
  - %page% - individual page number of the document
  - %totalpages% - the total number of pages for the document
  - %docsequence% - the doc sequence number
  - %docsequencetotal% - the total doc sequence number
  - %docname% - the instance display name of the document
  - %date% - the current system date in MM/DD/YYYY format
  - %BRCD . . .% - the custom barcode pattern containing optional characters
- BarcodeType: This object is a container for the BarcodeTypeEnum scope object where the format of the barcode is defined.
- BarcodeTypeEnum: A scope object containing four barcode type options.
  - barcode128 - Apply a barcode using Code 128. Code 128 is a high-density barcode that is used for alphanumeric or numeric-only barcodes and uses all 128 ASCII characters.
  - barcode39 - Apply a barcode using Code 39 (3 of 9, 3.9). Code 39 is a variable length, discrete barcode that uses 43 characters including uppercase letters (A through Z), numeric digits (0 through 9) and a number of special characters (-, ., $, /, +, %, and space).
  - barcodeInter25 - Apply a barcode using Interleaved 2 of 5 (I2/5). Interleaved 2 of 5 is a continuous two-width barcode. This code uses encoded digit pairs represented in a series of narrow and wide bars where 2 out of every 5 bars (or spaces) are wide.
  - barcode2D - Apply a barcode using a matrix (2D) barcode. The 2D barcode used in Expere is PDF417, a public domain linear barcode symbol format. This option produces a barcode based on the PDF 417 definition. Users can configure the following elements within the Barcode2DConfigurationOption element:
    - Error Correction Level
    - Columns
    - Rows
    - Aspect Ratio
    - Code Word Length
    - YHeight