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. |