DisplayBarcode is used to insert a standard bar code into a document. It supports 10 different types of barcode. Depending on the one you choose, the barcode type accepts alphanumeric data of different formats and lengths. As a field code, you can right-click and choose Toggle field codes to go between the code and the barcode image. See the example for several types of barcodes. For the specification, see DISPLAYBARCODE.


{ DisplayBarcode field-argument-1 field-argument-2 [ switches ] }

Field codes are not case sensitive.

  • Field-argument-1    Provides the data the barcode is representing. Depending on type, this can be numeric or alphanumeric. For example, a QR (Quick Response) code accepts a string of characters like a website address.

  • Field-argument-2    Is a string that specifies the type of barcode that will be generated. Barcode types are not case sensitive, so CODE39 is the same as Code39. The available types are as follows:

  • Switches    [optional] Field-specific switches. Some switches are barcode type specific.

    • \h [field-argument]    Field argument specifies the height of the barcode symbol. The units are in TWIPS (1/1440 inch).

    • \s [field-argument]    Field argument specifies a scaling factor for the symbol. The value is in whole percentage points and the valid values are from 10 to 1000.

    • \q [field-argument]    Field argument specifies the error correction level of QR Code. Valid values are 0 - 3.

    • \p [field-argument]    Field argument specifies the style of a Point of Sale barcode (barcode types UPCA|UPCE|EAN13|EAN8). The valid values (case insensitive) are [STD|SUP2|SUP5|CASE].

    • \x    Fixes the check digit if it’s invalid.

    • \d    Adds Start/Stop characters for barcode types NW7 and CODE39.

    • \c [field-argument]    Field argument specifies the style of a Case Code for barcode type ITF14. The valid values are [STD|EXT|ADD].

    • \r [field-argument]    Field argument specifies the rotation of the barcode symbol. Valid values are from 0 - 3.

    • \f [field-argument]    Field argument specifies the foreground color of the barcode symbol. Valid RGB values are in the range of 0 to 0xFFFFFF.

    • \b [field-argument]    Field argument specifies the background color of the barcode symbol. Valid RGB values are in the range of 0 to 0xFFFFFF.

    • \t     Display barcode data (text) along with image.


Each barcode may use its own data format, and so check some of the links if you're not sure what's needed.

To use DisplayBarcode in a document, follow these steps:

  1. Click or tap where you want the barcode.

  2. Press Ctrl + F9. You must do this, as just typing curly brackets {} won't work.

  3. Type DisplayBarcode plus arguments and switches. For example DisplayBarcode “http://www.microsoft.com” QR \q 3, which displays a QR code that links you to www.microsoft.com.

    A QR code of www.microsoft.com

  4. To see the barcode, right-click the Field code and select Toggle Field Codes.


Here are a few examples to get you going. Follow the steps above, and paste in the code here.

Code type

DisplayBarcode syntax

QR code

DisplayBarcode “http://www.microsoft.com” QR \q 3

EAN13 (with text)

DisplayBarcode “490123456789” EAN13 \t

Code 39

DisplayBarcode “2345678” CODE39 \d \t

Code 128

DisplayBarcode “490123456789” CODE128 \t


DisplayBarcode "012345678901" UPCA \t \x


DisplayBarcode "123456" UPCE \t \x

See also

Field codes: MergeBarcode DISPLAYBARCODE

Need more help?

Expand your skills


Get new features first


Was this information helpful?

What affected your experience?

Thank you for your feedback!