HotPDF Delphi组件:在PDF文档中创建垂直文本布局
HotPDF Delphi组件:在PDF文档中创建垂直文本布局 本综合指南演示了HotPDF组件如何让开发者轻松在PDF文档中生成Unicode垂直文本。 理解垂直排版(縦書き/세로쓰기/竖排) 垂直排版,也称为垂直书写,中文称为縱書,日文…
HotPDF Delphi组件:在PDF文档中创建垂直文本布局 本综合指南演示了HotPDF组件如何让开发者轻松在PDF文档中生成Unicode垂直文本。 理解垂直排版(縦書き/세로쓰기/竖排) 垂直排版,也称为垂直书写,中文称为縱書,日文…
Debugging PDF Page Order Issues: HotPDF Component Real Case Study Published by losLab | PDF Development | Delphi PDF Components PDF manipulation can be tricky, especially when dealing with page ordering. Recently, we encountered a fascinating debugging session that revealed…
This HotPDF Component Sample draw plots with Delphi TCanvas.
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
|
program CanvasDraw;
{$APPTYPE CONSOLE}
uses
{$IFDEF VER230} System.SysUtils, System.Classes, Vcl.Graphics, {$ELSE} SysUtils, Classes, Graphics, {$ENDIF} HPDFDoc;
var
I, Y: Integer;
HotPDF: THotPDF;
begin
HotPDF:= THotPDF.Create(nil);
try
Randomize;
HotPDF.AutoLaunch := true;
HotPDF.FileName := 'CanvasDraw.pdf';
HotPDF.BeginDoc; // Create PDF file
HotPDF.Canvas.Font.Size := 14; // Set canvas font size
I :=20;
Y := 60;
HotPDF.Canvas.TextOut(10, 30, 'Canvas Rectangles'); // Print text
while I <= 700 do
begin // Draw colour
HotPDF.Canvas.Brush.Color := random($FFFFFF); // rectangles
HotPDF.Canvas.Rectangle(I, Y, I+90, Y + 160);
Inc(I, 30);
Inc( Y, 3 );
end;
I :=20;
Y := 350;
HotPDF.Canvas.TextOut(10, 320, 'Canvas Ellipses'); // Print text
while I <= 700 do // Draw colour
begin // ellipses
HotPDF.Canvas.Brush.Color := random($FFFFFF);
HotPDF.Canvas.Ellipse(I, Y, I+90, Y + 160);
Inc(I, 30);
Inc( Y, 3 );
end;
I :=20;
Y := 680;
HotPDF.Canvas.TextOut(10, 650, 'Canvas RoundRects'); // Print text
while I <= 700 do
begin
HotPDF.Canvas.Brush.Color := random($FFFFFF); // Draw colour
HotPDF.Canvas.RoundRect(I, Y, I+90, Y + 160, 20, 20); // roundrects
Inc(I, 30);
Inc( Y, 3 );
end;
HotPDF.EndDoc; // Close PDF file
finally
HotPDF.Free;
end;
end.
|
HotPDF Component Database Table To PDF sample
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
program TableDemo;
{$APPTYPE CONSOLE}
{ Reduce EXE size by disabling as much of RTTI as possible }
{$IFDEF VER210}
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$ENDIF}
uses
{$IFDEF VER230}System.Classes, System.SysUtils, Vcl.Graphics, DB, DBTables,
{$ELSE} Classes, SysUtils, Graphics, DB, DBTables,
{$ENDIF} HPDFDoc;
var
HotPDF: THotPDF;
PageNum, VertPos: Integer;
CustomerTable: TTable;
Back: boolean;
procedure PrintRow(Position: Integer; No, Company, Addr, City: AnsiString; ShowBackground: boolean);
begin
if ShowBackground then
begin
HotPDF.CurrentPage.SetRGBColor($FFF3DD);
HotPDF.CurrentPage.Rectangle(50, Position, 520, 20);
HotPDF.CurrentPage.Fill;
HotPDF.CurrentPage.SetRGBColor(clBlack);
end;
HotPDF.CurrentPage.TextOut(70, Position, 0, No);
HotPDF.CurrentPage.TextOut(110, Position, 0, Company);
HotPDF.CurrentPage.TextOut(300, Position, 0, Addr);
HotPDF.CurrentPage.TextOut(480, Position, 0, City);
end;
procedure PreparePage;
begin
HotPDF.CurrentPage.SetFont('Arial', [fsItalic], 10);
HotPDF.CurrentPage.TextOut(50, VertPos, 0, 'customer.db' + ' Page' + AnsiString(IntToStr(PageNum)));
HotPDF.CurrentPage.TextOut(480, VertPos, 0, AnsiString(DateTimeToStr(Now)));
HotPDF.CurrentPage.MoveTo(50, VertPos + 15);
HotPDF.CurrentPage.LineTo(570, VertPos + 15);
HotPDF.CurrentPage.MoveTo(50, VertPos + 45);
HotPDF.CurrentPage.LineTo(570, VertPos + 45);
HotPDF.CurrentPage.Stroke;
HotPDF.CurrentPage.SetFont('Times New Roman', [fsItalic, fsBold], 12);
HotPDF.CurrentPage.SetRGBFillColor(clNavy);
PrintRow(VertPos + 25, 'No', 'Company', 'Addr', 'City', false);
HotPDF.CurrentPage.SetRGBFillColor(clBlack);
Inc(VertPos, 20);
end;
begin
CustomerTable := TTable.Create(nil);
try
CustomerTable.DatabaseName := 'DBDEMOS';
CustomerTable.TableName := GetCurrentDir + '\customer.db';
CustomerTable.Active := true;
CustomerTable.First;
HotPDF := THotPDF.Create(nil);
try
HotPDF.AutoLaunch := true;
HotPDF.FileName := 'TableDemo.pdf';
HotPDF.PageLayout := plOneColumn;
HotPDF.BeginDoc;
HotPDF.CurrentPage.SetFont('Arial', [fsBold], 24);
HotPDF.CurrentPage.TextOut(200, 20, 0, 'Customer report'); // Print PDF header
PageNum := 1;
VertPos := 60;
PreparePage; // Table header
Back := true;
while (not(CustomerTable.Eof)) do
begin
Back := not(Back);
if (VertPos > 700) then // If end of page then
begin
HotPDF.AddPage; // Add page, draw and print
Inc(PageNum); // table header and set
VertPos := 60; // new print position
PreparePage;
end;
PrintRow(VertPos + 25, // print row from the current position
AnsiString(CustomerTable.FieldValues['CustNo']), AnsiString(CustomerTable.FieldValues['Company']),
AnsiString(CustomerTable.FieldValues['Addr1']), AnsiString(CustomerTable.FieldValues['City']), Back);
Inc(VertPos, 20);
CustomerTable.Next;
end;
HotPDF.EndDoc;
finally
HotPDF.Free;
end;
finally
CustomerTable.Free;
end;
end.
|
This HotPDF Component example show charts in PDF document using TeeChart.
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
unit ChartUnit;
interface
uses
{$IF CompilerVersion >= 16} Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, VclTee.TeeGDIPlus, VclTee.TeEngine, VclTee.Series, VclTee.TeeProcs, VclTee.Chart,
{$ELSE}Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, TeEngine, Series, TeeProcs, Chart,
{$ENDIF} HPDFDoc;
type
TForm1 = class(TForm)
RadioGroup1: TRadioGroup;
DemoChart: TChart;
BarSeries1: TBarSeries;
BarSeries2: TBarSeries;
BarSeries3: TBarSeries;
Panel1: TPanel;
Label1: TLabel;
RadioGroup2: TRadioGroup;
ComboBox1: TComboBox;
Button1: TButton;
procedure RadioGroup1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
Case RadioGroup1.ItemIndex of
0: BarSeries1.MultiBar:=mbNone;
1: BarSeries1.MultiBar:=mbSide;
2: BarSeries1.MultiBar:=mbStacked;
3: BarSeries1.MultiBar:=mbStacked100;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
H: Integer;
begin
DemoChart.View3D:=False;
Randomize;
{$IFDEF VER220}
with BarSeries1 do
for H:=1 to 12 do Add( Random(100),FormatSettings.ShortMonthNames[H],clTeeColor);
with BarSeries2 do
for H:=1 to 12 do Add( Random(100),FormatSettings.ShortMonthNames[H],clTeeColor);
with BarSeries3 do
for H:=1 to 12 do Add( Random(100),FormatSettings.ShortMonthNames[H],clTeeColor);
{$ELSE}
with BarSeries1 do
for H:=1 to 12 do Add( Random(100),ShortMonthNames[H],clTeeColor);
with BarSeries2 do
for H:=1 to 12 do Add( Random(100),ShortMonthNames[H],clTeeColor);
with BarSeries3 do
for H:=1 to 12 do Add( Random(100),ShortMonthNames[H],clTeeColor);
{$ENDIF}
ComboBox1.Items.Clear;
for H:=0 to DemoChart.SeriesCount-1 do
ComboBox1.Items.Add(DemoChart.Series[H].Name);
ComboBox1.ItemIndex:=0;
end;
procedure TForm1.RadioGroup2Click(Sender: TObject);
begin
With DemoChart.Series[ComboBox1.ItemIndex] as TBarSeries do
BarStyle:=TBarStyle(RadioGroup2.Itemindex);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
HotPDF: THotPDF;
ChartRect: TRect;
begin
HotPDF := THotPDF.Create(nil);
try
case RadioGroup1.ItemIndex of
0: HotPDF.FileName := 'PDFChart-Behind.pdf';
1: HotPDF.FileName := 'PDFChart-SideToSide.pdf';
2: HotPDF.FileName := 'PDFChart-Stacked.pdf';
3: HotPDF.FileName := 'PDFChart-Stacked100.pdf';
end;
HotPDF.BeginDoc;
ChartRect.Left := 0;
ChartRect.Right := 800;
ChartRect.Top := 0;
ChartRect.Bottom := 600;
DemoChart.PrintPartialCanvas( HotPDF.CurrentPage.Canvas, ChartRect );
HotPDF.EndDoc;
finally
HotPDF.Free;
end;
end;
end.
|
Implementing 22 Barcode Types with HotPDF Delphi Component In today’s digital world, barcodes serve as the backbone of inventory management, retail operations, and data tracking systems. The ability to generate professional PDF documents containing various barcode types has become essential…
This HotPDF Component Sample adds clickable hyperlinks into PDF document.
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
|
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, StdCtrls, Forms, Dialogs, HPDFDoc;
type
TForm1 = class(TForm)
HotPDF: THotPDF;
HelloWorldButton: TButton;
edtWeb: TEdit;
edtProduct: TEdit;
edtOrder: TEdit;
edtContact: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure HelloWorldButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.HelloWorldButtonClick(Sender: TObject);
begin
HotPDF.BeginDoc;
HotPDF.CurrentPage.SetFont( 'Microsoft Sans Serif', [], 13 );
HotPDF.CurrentPage.TextOut(20,30,0,'Clickable links:');
HotPDF.CurrentPage.PrintHyperlink(20, 60, 'Company site: ' + edtWeb.Text, edtWeb.Text);
HotPDF.CurrentPage.PrintHyperlink(20, 80, 'Product page: ' + edtProduct.Text, edtProduct.Text);
HotPDF.CurrentPage.SetRGBHyperlinkColor(clRed);
HotPDF.CurrentPage.PrintHyperlink(20, 100, 'Purchase link: ' + edtOrder.Text, edtOrder.Text);
HotPDF.CurrentPage.SetRGBHyperlinkColor(clBlue);
HotPDF.CurrentPage.PrintHyperlink(20, 120, 'Contact form: ' + edtContact.Text, edtContact.Text);
HotPDF.EndDoc;
end;
end.
|
Mastering PDF Annotations with HotPDF Component PDF annotations are one of the most powerful features for creating interactive and collaborative documents. They allow users to add comments, highlights, stamps, and multimedia content directly to PDF files without modifying the original…
HotPDF Delphi Component: Creating Vertical Text Layouts in PDF Documents This comprehensive guide demonstrates how the H…
HotPDF Component Delphi TextOut Sample – Font Styling and Charset This comprehensive HotPDF component TextOut sample demonstrates advanced font handling, character set support, text scaling, spacing adjustments, and rendering modes. The sample generates detailed font and character set demonstrations with…