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
AssignCopies barcode configuration from another persistent object
DrawBarcodeDraws the bars for the configured barcode on the supplied TCanvas
DrawTextDraws the optional text label on the supplied TCanvas
CanvasHeightReturns the rotated drawing height needed for the configured Width, Height, and Angle
CanvasWidthReturns 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
TextCung 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ợ
TypChọn kiểu barcode theo giá trị ordinal của THPDFBarcodeType
Checksum, CheckSumMethodBật đầu ra checksum và chọn csmNone hoặc csmModulo10
AngleXoay 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
OnChangeNhậ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
THPDFBarcodeTypebcCode_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
THPDFBarcodeOptionbcoNone, bcoCode, bcoTyp, bcoBoth
THPDFShowTextPositionstpTopLeft, stpTopRight, stpTopCenter, stpBottomLeft, stpBottomRight, stpBottomCenter
THPDFCheckSumMethodcsmNone, csmModulo10
THPDFBarLineTypewhite, 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
TSimpleBarcodeBarWidth 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
TSimpleBarArrayMả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/5SimpleCode25Interleaved, SimpleCode25Industrial, SimpleCode25Matrix
Code 39 and Code 93SimpleCode39, SimpleCode39Extended, SimpleCode93, SimpleCode93Extended
Code 128 and EAN-128SimpleCode128A, SimpleCode128B, SimpleCode128C, SimpleEAN128A, SimpleEAN128B, SimpleEAN128C
Retail and postalSimpleEAN8, SimpleEAN13, SimpleUPC_A, SimpleUPC_E0, SimpleUPC_E1, SimpleUPC_Supp2, SimpleUPC_Supp5, SimplePostNet
Other supported symbologiesSimpleMSI, SimpleCodebar

Example

var
  Bars: TSimpleBarArray;
  TotalWidth: Integer;
begin
  TotalWidth := SimpleCode128B('ABC-123', Bars);
end;

Xem thêm