DrawBarcode

矢量图形、条码

描述

在选定页面上绘制条码

对于 Code128,条形码由 "B" 和 "C" 字符集组合而成,从而获得最紧凑的表示

将 Barcode 参数设为 3(Code128),并在适当位置使用字符串 "[FNC1]" 或 ASCII GS 字符(#29),即可绘制 GS1-128 条形码(也称为 EAN-128),例如:

"[FNC1]21ABC123[FNC1]2013"

前述示例表示序列号(AI 21)为 "ABC123",产品变体(AI 20)为 "13"

语法

Delphi

Function TPDFlib.DrawBarcode(Left, Top, Width, Height: Double; Const Text: WideString; Barcode, Options: Integer): Integer;

ActiveX

Function PDFlib::DrawBarcode(Left As Double, Top As Double, Width As Double, Height As Double, Text As String, Barcode As Long, Options As Long) As Long

DLL

int DLDrawBarcode(int InstanceID, double Left, double Top, double Width, double Height, const wchar_t* Text, int Barcode, int Options);
int DLDrawBarcodeA(int InstanceID, double Left, double Top, double Width, double Height, const char* Text, int Barcode, int Options);

参数

Left条码左边缘的水平坐标
Top条形码顶部边缘的垂直坐标
Width条形码的宽度
Height条形码的高度
Text条形码数据,可通过在条形码数据字符串后追加以下内容旋转条形码:/RC = 顺时针旋转 /RA = 逆时针旋转 /RU = 旋转 180 度
Barcode1 = Code39(或 Code 3 of 9);2 = EAN-13;3 = Code128;4 = PostNet;5 = Interleaved 2 of 5;6 = EAN-8;7 = UPC-A;8 = Code93;9 = UPC-E;10 = Codabar
OptionsCode39:0 = 默认绘制 EAN-13:0 = 仅绘制条码 1 = 延伸保护条 2 = 绘制人类可读数字 3 = 绘制带右侧间隔的人类可读数字 Code128:0 = 默认绘制 PostNet:0 = 默认绘制 Interleaved 2 of 5:0 = 不添加校验和,无承载条 1 = 添加校验和字符,无承载条 2 = 不添加校验和,绘制承载条 3 = 添加校验和字符,绘制承载条 要对条码应用 10% 条宽缩减,请将 Options 参数值增加 10

类型 10 绘制 Codabar(BS EN 798):文本必须以起始/终止字母 A B C D 之一开头和结尾,正文可包含数字和符号 - $ : / . +;该符号采用宽元素为 3 个模块的 rationalized 编码

类型 9 绘制 UPC-E:传入六个数据位,位数不足时在左侧补零;或传入完整的八位形式,即数字系统 0、六个数据位和会加以验证的校验位;数字以外的字符将被忽略,其他位数、其他数字系统或错误的校验位都会使调用返回 0

返回值

0无法绘制条形码。Barcode 或 Options 参数无效
1条形码已成功绘制