HPDFBarcode Unit Reference

HPDFBarcode unit은 THPDFPage.DrawBarcode가 사용하는 barcode component와 low-level bar encoder helper를 노출합니다

직접 PDF page output에는 THPDFPage.DrawBarcode를 사용하고, VCL TCanvas에 렌더링할 때는 THPDFBarcode를 사용하며, drawing 전에 generated bar sequence가 필요한 application은 Simple* function을 사용하십시오

THPDFBarcode

THPDFBarcode는 configured barcode를 VCL canvas에 렌더링하는 TComponent descendant이며, 선택적으로 human-readable text label을 그릴 수 있습니다

Member Usage
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는 layout, barcode type, checksum, colour, text-label, change notification setting을 published합니다

Property Usage
Height, WidthSet the barcode drawing height and read or assign the calculated barcode width
TextSupplies the barcode payload as an AnsiString
맨 위, LeftSet the canvas origin for the barcode output
ModulSets the base module width used when bars are painted
RatioSets the wide-to-narrow bar ratio used by supported symbologies
TypSelects the barcode type by the ordinal value of THPDFBarcodeType
Checksum, CheckSum 메서드Enable checksum output and choose csmNone or csmModulo10
AngleRotates the rendered barcode
ShowText, ShowTextFont, ShowTextPositionControl whether the readable text is drawn, which font is used, and where the label is placed
Color, ColorBarSet the background colour and bar colour
OnChangeReceives a TNotifyEvent when a property setter changes barcode state

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
THPDFCheckSum 메서드csmNone, csmModulo10
THPDFBarLineTypewhite, black, black_half

Simple Bar Records

Simple encoder function은 TSimpleBarcodeBar record array인 TSimpleBarArray를 통해 generated bar를 반환합니다

Record Fields
TSimpleBarcodeBarWidth contains the module width contribution, and Filled identifies whether the segment is a printed bar
TSimpleBarArrayDynamic array of TSimpleBarcodeBar values filled by the Simple* functions

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;

참조