This HotPDF Component example generates barcode within PDF for 22 popular types.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
program Barcodes; {$APPTYPE CONSOLE} uses {$IFDEF VER230} System.Classes, System.SysUtils, Vcl.Graphics, {$ELSE} Classes, SysUtils, Graphics, {$ENDIF} HPDFDoc; var I, H: Integer; HotPDF: THotPDF; const Names: array[0..21] of string = ( 'Code 25 Interleaved', 'Code 25 Industrial', 'Code 25 Matrix', 'Code39', 'Code39 Extended', 'Code128A', 'Code128B', 'Code128C', 'Code93', 'Code93 Extended', 'MSI', 'PostNet', 'Codebar', 'EAN8', 'EAN13', 'UPC_A', 'UPC_E0', 'UPC_E1', 'UPC Supp2', 'UPC Supp5', 'EAN128A', 'EAN128B' ); begin HotPDF:= THotPDF.Create(nil); try HotPDF.AutoLaunch := true; HotPDF.FileName := 'Barcodes.pdf'; HotPDF.BeginDoc; for I := 0 to 7 do begin for H := 0 to 2 do begin if ((I * 3) + H) > 21 then Break; HotPDF.CurrentPage.DrawBarcode( THPDFBarcodeType((I * 3) + H), // Draw Black barcode H * 266 + 67, I * 133 + 69, // on the white background 50, 1, 0, '12345', true, 0, clWhite ); // Draw 12345 HotPDF.CurrentPage.TextOut( H * 200 + 50, I * 100 + 35, 0, Names[(I * 3) + H] ); // Print barcode name end; end; HotPDF.EndDoc; finally HotPDF.Free; end; end. |