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 3.1.3.2.7 DISPLAYBARCODE.
Syntax
{ 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:
-
QR A QR 2D bar code. See Wikipedia: QR code. For the ISO specification, see ISO/IEC 18004:2006.
-
CODE128 A Code 128 linear bar code. See Wikipedia: Code 128. For the ISO specification, see ISO/IEC 15417:2007.
-
CODE39 A Code 39 linear bar code. See Wikipedia: Code 39. For the a Code 39 Faq and Tutorial, see Code 39 Barcode FAQ & Tutorial.
-
JPPOST A Japanese Postal Service Customer barcode. JPPost is compliant with CBC (Customer Bar Code), which is also known as RM4SCC.
-
EAN8|EAN13 An EAN - International Article Number worldwide bar code for product ID’s (8 digit/13 digit), along with JAN8|JAN13, used where country of origin is required. See Wikipedia: EAN-8, Wikipedia: International Article Number (EAN-13), and EAN-13 and EAN-8.
-
JAN8|JAN13 A JAN: Japanese barcode for product ID’s (8 digit/13 digit). JAN8 is an alias of EAN8. JAN13 is an alias of EAN13.
-
UPCA|UPCE A UPC (A&E): US barcode for product ID’s as specified in [GS1-BARCODE]. UPCA is used for most edible items, UPCE is a compressed version of UPCA. carrying the same data. See Wikipedia: Universal Product Code.
-
NW7 A NW-7 (CODABAR) serial number bar code. See Codabar (NW7).
-
ITF14 An ITF-14 item-tracking barcode for shipping and tracking as specified in [GS1-BARCODE]. See Wikipedia: ITF 14 and ITF-14 BARCODES.
-
CASE USPS barcode – FIM/POSTNET (*2) - barcode for tracking USPS mail. CASE is an alias of ITF14. See ITF-14 BARCODES.
-
-
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.
-
Instructions
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:
-
Click or tap where you want the barcode.
-
Press Ctrl + F9. You must do this, as just typing curly brackets {} won't work.
-
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.
-
To see the barcode, right-click the Field code and select Toggle Field Codes.
Examples
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 |
UPCA |
DisplayBarcode "012345678901" UPCA \t \x |
UPCE |
DisplayBarcode "123456" UPCE \t \x |