HotPDF Hyperlink Sample

HotPDF Hyperlink Sample

This HotPDF Component Sample adds clickable hyperlinks into PDF document.

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.
Comments are closed.