|
Tham chiếu unit HPDFBarcode
Unit HPDFBarcode cung cấp component barcode và các helper mã hóa thanh mức thấp được dùng bởi THPDFPage.DrawBarcode
Dùng THPDFPage.DrawBarcode cho đầu ra PDF trực tiếp trên trang, dùng THPDFBarcode khi render lên TCanvas của VCL, và dùng các hàm Simple* khi ứng dụng cần chuỗi thanh đã tạo trước khi vẽ
THPDFBarcode
THPDFBarcode là một lớp con của TComponent để render barcode đã cấu hình lên canvas VCL và có thể tùy chọn vẽ nhãn văn bản đọc được
| Member |
Cách dùng |
Assign | Copies barcode configuration from another persistent object |
DrawBarcode | Draws the bars for the configured barcode on the supplied TCanvas |
DrawText | Draws the optional text label on the supplied TCanvas |
CanvasHeight | Returns the rotated drawing height needed for the configured Width, Height, and Angle |
CanvasWidth | Returns the rotated drawing width needed for the configured Width, Height, and Angle |
Published Properties
Component này công bố các thiết lập về bố cục, kiểu barcode, checksum, màu sắc, nhãn văn bản và thông báo thay đổi
| Property |
Cách dùng |
Height, Width | Đặt chiều cao vẽ barcode và đọc hoặc gán chiều rộng barcode đã tính |
Text | Cung cấp dữ liệu barcode dưới dạng AnsiString |
Đầu trang, Left | Đặt gốc trên canvas cho đầu ra barcode |
Modul | Đặt độ rộng mô-đun cơ sở dùng khi vẽ các thanh |
Ratio | Đặt tỷ lệ thanh rộng so với thanh hẹp cho các bộ mã được hỗ trợ |
Typ | Chọn kiểu barcode theo giá trị ordinal của THPDFBarcodeType |
Checksum, CheckSumMethod | Bật đầu ra checksum và chọn csmNone hoặc csmModulo10 |
Angle | Xoay barcode đã render |
ShowText, ShowTextFont, ShowTextPosition | Điều khiển việc có vẽ văn bản đọc được hay không, dùng phông nào và đặt nhãn ở đâu |
Color, ColorBar | Đặt màu nền và màu thanh |
OnChange | Nhận một TNotifyEvent khi setter của thuộc tính làm thay đổi trạng thái barcode |
Barcode Types and Options
| Type |
Values |
THPDFBarcodeType | bcCode_2_5_interleaved, bcCode_2_5_industrial, bcCode_2_5_matrix, bcCode39, bcCode39Extended, bcCode128A, bcCode128B, bcCode128C, bcCode93, bcCode93Extended, bcCodeMSI, bcCodePostNet, bcCodeCodabar, bcCodeEAN8, bcCodeEAN13, bcCodeUPC_A, bcCodeUPC_E0, bcCodeUPC_E1, bcCodeUPC_Supp2, bcCodeUPC_Supp5, bcCodeEAN128A, bcCodeEAN128B, bcCodeEAN128C |
THPDFBarcodeOption | bcoNone, bcoCode, bcoTyp, bcoBoth |
THPDFShowTextPosition | stpTopLeft, stpTopRight, stpTopCenter, stpBottomLeft, stpBottomRight, stpBottomCenter |
THPDFCheckSumMethod | csmNone, csmModulo10 |
THPDFBarLineType | white, black, black_half |
Simple Bar Records
Các hàm mã hóa đơn giản trả về các thanh đã tạo qua TSimpleBarArray, là một mảng các bản ghi TSimpleBarcodeBar
| Record |
Trường |
TSimpleBarcodeBar | Width chứa phần đóng góp của độ rộng mô-đun, còn Filled cho biết đoạn đó có phải là một thanh in hay không |
TSimpleBarArray | Mảng động các giá trị TSimpleBarcodeBar do các hàm Simple* điền vào |
Simple Encoder Functions
Each function has the signature function Name(const Text: AnsiString; var Bars: TSimpleBarArray): Integer and returns the total generated bar width
| Group |
Functions |
| Code 2/5 | SimpleCode25Interleaved, SimpleCode25Industrial, SimpleCode25Matrix |
| Code 39 and Code 93 | SimpleCode39, SimpleCode39Extended, SimpleCode93, SimpleCode93Extended |
| Code 128 and EAN-128 | SimpleCode128A, SimpleCode128B, SimpleCode128C, SimpleEAN128A, SimpleEAN128B, SimpleEAN128C |
| Retail and postal | SimpleEAN8, SimpleEAN13, SimpleUPC_A, SimpleUPC_E0, SimpleUPC_E1, SimpleUPC_Supp2, SimpleUPC_Supp5, SimplePostNet |
| Other supported symbologies | SimpleMSI, SimpleCodebar |
Example
var
Bars: TSimpleBarArray;
TotalWidth: Integer;
begin
TotalWidth := SimpleCode128B('ABC-123', Bars);
end;
Xem thêm
|