Insert a bar code on a document page
Use the AddBarcode function to insert a bar code on a document page. This function is supported in all streaming exit points.
The function has the following parameters:
- BarCode.Type.
Required. Type of bar code.
This functionality uses the DocBridge Mill toolkit to produce the actual bar codes. The following bar code types are supported: POSTNET, QR code, EAN 13, EAN 8, CODE 128, MSI, Code 39, and Planet. For the complete list of supported types, see the DocBridge Mill documentation.
- BarCode.CheckDigits. Optional. Number of check digits. A check digit is the number located in the far right side of a bar code, and is used to verify the information entered on the bar code. Possible values depend on the bar code type; default is 0.
- BarCode.Data. Required. Value of the bar code. Must also include check digits.
- BarCode.QuietZone. Optional. Set to True to add a quiet zone to the bar code. Default is false (no quiet zone). A quiet zone is a margin on the left and right side of a bar code. Not supported by some bar code types. If not supported, this setting is ignored.
- BarCode.Readable. Optional. Set to true to show the human readable interpretation (HRI) of the bar code. For example, HRI can be digits below a standard EAN bar code. Default is false (no HRI). Not supported by some bar code types.
- BarCode.Angle. Optional. The angle in degrees to rotate the bar code. Possible values: 90, 180, and 270 degrees. Default is 0.
- BarCode.X. Optional. The X-axis position of the bar code in mm. Default is 0.
- BarCode.Y. Optional. The Y-axis position of the bar code in mm. Default is 0.
- BarCode.Ratio. Optional. Ratio of height and width. Not supported by some bar code types. Default is 1.
- BarCode.Height. Optional. Bar code height in mm. Default is 0.
- BarCode.Width. Optional. Bar code width in mm. Default is 0.
Example script
BarCode = document.AddBarcode()
BarCode.Type = "EAN 13"
BarCode.CheckDigits = 1
BarCode.Data = "978159059389"
BarCode.Readable = true
BarCode.Angle = 90
BarCode.X = 12
BarCode.Y = 3
BarCode.Height = 10
BarCode.Width = 30
BarCode.Post()
This example adds a bar code with value 978159059389 of type EAN 13 with height 10 mm and width 30 mm at 12 mm from the left side and 3 mm of the top of the document with 1 check digit and with no quiet zone. The bar code is rotated at an angle of 90 degrees and shows the human readable interpretation.