Category: PDF Software

C++Builder dynamic create & delete HotPDF component instance

This example shows you how to programmatically New and Free a HotPDF object instance with C++Builder.

#include 
#pragma hdrstop

#include "Unit1.h"
#pragma package(smart_init)
#pragma link "HPDFDoc"
#pragma resource "*.dfm"
TForm1 *Form1;

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{

    THotPDF* HotPDF1 = new THotPDF(this);
    HotPDF1->FileName = "HelloWorld.pdf";
    HotPDF1->AutoLaunch = true;      
    HotPDF1->BeginDoc(false);
    HotPDF1->CurrentPage->PrintText( 10, 10, 0, "Hello World!" );
    HotPDF1->EndDoc();
    HotPDF1->Free(); 	
}

You need to set the include & library path of the project to the directory where HotPDF library files exist.

HotPDF Canvas Draw

This HotPDF Component Sample draw plots with Delphi TCanvas.

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 Table To PDF

HotPDF Component Database Table To PDF sample

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.

HotPDF Chart Sample

This HotPDF Component example show charts in PDF document using TeeChart.

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.

HotPDF Barcode Sample

This HotPDF Component example generates barcode within PDF for 22 popular types.

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.

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.

HotPDF Text Annotation

This HotPDF Component sample adds a text annotation at the specified location of the PDF document.

program Annotation;
{$APPTYPE CONSOLE}

uses
{$IFDEF VER230} System.Classes, System.SysUtils, Vcl.Graphics,
{$ELSE} Classes, SysUtils, Graphics, {$ENDIF} HPDFDoc;

var
  HotPDF: THotPDF;
begin
  HotPDF := THotPDF.Create(nil);
  try
    HotPDF.FileName := 'Annotation.pdf';
    HotPDF.BeginDoc;
    HotPDF.CurrentPage.TextOut(120,65,0,'Click the icon:');
    HotPDF.CurrentPage.AddTextAnnotation( 'This is a text annotation.' + #13#10  
      + 'Dies ist eine Textanmerkung.' + #13#10
      + 'Ceci est une annotation textuelle.' + #13#10, 
      Rect(120, 80, 140, 100), true, taComment, clBlue );
    HotPDF.EndDoc;
  finally
    HotPDF.Free;
  end;
end.

HotPDF Vertical Text Sample

This example demonstrates how the HotPDF component generates Unicode vertical text.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, HPDFDoc;

type
  TForm1 = class(TForm)
    Button1: TButton;
    HotPDF: THotPDF;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
{$R *.DFM}
// Delphi 7 cannot display Unicode characters correctly.
// You need Delphi 2007 or above to open this file.

procedure TForm1.Button1Click(Sender: TObject);
begin
  HotPDF.BeginDoc;
  HotPDF.FileName := 'VerticalText.pdf';

  HotPDF.CurrentPage.SetFont('Arial Unicode MS', [], 12, 0, False);  //Set horizontal text
  HotPDF.CurrentPage.UnicodeTextOut( 30, 10, 0, 'Horizontal Text Горизонтальный текст 横書き');  //Print horizontal text

  HotPDF.CurrentPage.SetFont('Arial Unicode MS', [], 12, 0, True);  //Set vertical text
  HotPDF.CurrentPage.UnicodeTextOut( 30, 40, 0, 'Vertical Text');   //Print vertical text
  HotPDF.CurrentPage.UnicodeTextOut( 70, 40, 0, 'Texto vertical');
  HotPDF.CurrentPage.UnicodeTextOut( 110, 40, 0, 'Vertikaler Text');
  HotPDF.CurrentPage.UnicodeTextOut( 150, 40, 0, 'Texte vertical');
  HotPDF.CurrentPage.UnicodeTextOut( 190, 40, 0, 'Вертикальный текст');
  HotPDF.CurrentPage.UnicodeTextOut( 230, 40, 0, 'Testo verticale');
  HotPDF.CurrentPage.UnicodeTextOut( 270, 40, 0, '垂直文本');
  HotPDF.CurrentPage.UnicodeTextOut( 310, 40, 0, '縦書きテキスト');
  HotPDF.CurrentPage.UnicodeTextOut( 350, 40, 0, 'Verticale tekst');
  HotPDF.CurrentPage.SetFont('Malgun Gothic Semilight', [], 12, 0, True);  //Set Korean Font
  HotPDF.CurrentPage.UnicodeTextOut( 390, 40, 0, '한국어 텍스트');
  HotPDF.EndDoc;
end;
end.

HotPDF Text Out Sample

HotPDF component text out sample generates font and character set demonstration, as shown in the image above.

program TextOut;
{$APPTYPE CONSOLE}
uses
  SysUtils, Graphics, Classes, Windows, HPDFDoc;

var
  HotPDF: THotPDF;
  OutlineRoot: THPDFDocOutlineObject;
  CurrnetOutline: THPDFDocOutlineObject;

procedure ShowFontGroup ( FontGroup: AnsiString; Position: Integer );
begin
  HotPDF.CurrentPage.SetFont( FontGroup, [], 12); 
  HotPDF.CurrentPage.TextOut( Position, 60, 0, FontGroup );
  HotPDF.CurrentPage.SetFont( FontGroup, [fsBold], 12);
  HotPDF.CurrentPage.TextOut( Position, 80, 1, FontGroup+'-Bold' );
  // Show font with positive rotation
  HotPDF.CurrentPage.SetFont( FontGroup, [fsItalic], 12);
  HotPDF.CurrentPage.TextOut( Position, 100, -1, FontGroup+'-Italic' );      
  // Show font with negative rotation
  HotPDF.CurrentPage.SetFont( FontGroup, [fsBold, fsItalic], 12);
  HotPDF.CurrentPage.TextOut( Position, 120, 0, FontGroup+'-Bold-Italic' );
end;

procedure ShowCharset ( FontCharset: TFontCharset; First, Last: Integer; Y1, Y2: Integer );
var
  i: Integer;
  CSName: AnsiString;
begin
  // https://docs.microsoft.com/en-us/previous-versions/cc194829(v=msdn.10)
  case FontCharset of
    ARABIC_CHARSET: CSName := 'ARABIC_CHARSET';
    EASTEUROPE_CHARSET: CSName := 'EASTEUROPE_CHARSET';
    OEM_CHARSET: CSName := 'OEM_CHARSET';
    RUSSIAN_CHARSET: CSName := 'RUSSIAN_CHARSET';
    TURKISH_CHARSET: CSName := 'TURKISH_CHARSET';
  end;
  HotPDF.CurrentPage.SetFont( 'Arial', [fsBold, fsItalic], 12); 
  HotPDF.CurrentPage.TextOut ( 50, Y1, 0, CSName + ' example: ');
  HotPDF.CurrentPage.SetFont( 'Arial', [], 14, FontCharset );
  for I := First to Last do
  begin
    HotPDF.CurrentPage.TextOut( 30 + (I mod 25) * 22, Y2 + (I div 25) * 17, 0 , AnsiChar(chr(I)) );
    //Show a sequence of characters in the computed position.
  end;
end;

procedure ShowTable ( X, Y: Integer);
begin
  HotPDF.CurrentPage.Rectangle(X, Y, 300, 50);
  HotPDF.CurrentPage.Stroke;
  HotPDF.CurrentPage.Rectangle(X, Y + 50, 300, 50);
  HotPDF.CurrentPage.Stroke;
  HotPDF.CurrentPage.MoveTo( X + 130, Y );
  HotPDF.CurrentPage.LineTo( X + 130, Y + 100 );
  HotPDF.CurrentPage.Stroke;
end;

begin
  HotPDF:= THotPDF.Create(nil);
  try
    HotPDF.AutoLaunch := true;

    HotPDF.NotEmbeddedFonts.Add('Arial');
    HotPDF.StandardFontEmulation := true;

    HotPDF.FileName := 'TextOut.pdf';     
    HotPDF.PageLayout := plOneColumn;

    HotPDF.BeginDoc( true );
    OutlineRoot := HotPDF.OutlineRoot;

    //---------------------------  Show fonts   --------------------------//
    HotPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 20);
    HotPDF.CurrentPage.TextOut( 195, 20, 0, 'Show Fonts' );
    OutlineRoot.AddChild( 'Show Fonts', 180, 20 );
    // Add Outline block linked to 180, 20 in current page

    ShowFontGroup( 'Arial', 50 );
    ShowFontGroup( 'Times New Roman', 180 );
    ShowFontGroup( 'Courier New', 350 );

    //---------------------------  Charsets   --------------------------//
    HotPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 20);
    HotPDF.CurrentPage.TextOut( 200, 160, 0, 'Charsets' );
    CurrnetOutline := OutlineRoot.AddChild( 'Charsets', 250, 170 );
    CurrnetOutline.Opened := true;

    CurrnetOutline.AddChild( 'ARABIC_CHARSET', 210, 110 );
    ShowCharset ( ARABIC_CHARSET, 160, 250, 210, 110 );

    CurrnetOutline.AddChild( 'EASTEUROPE_CHARSET', 320, 220 );
    ShowCharset ( EASTEUROPE_CHARSET, 160, 250, 320, 220 );

    CurrnetOutline.AddChild( 'OEM_CHARSET', 430, 330 );
    ShowCharset ( OEM_CHARSET, 160, 250, 430, 330 );

    CurrnetOutline.AddChild( 'RUSSIAN_CHARSET', 540, 440 );
    ShowCharset ( RUSSIAN_CHARSET, 160, 250, 540, 440 );

    CurrnetOutline.AddChild( 'TURKISH_CHARSET', 650, 550 );
    ShowCharset ( TURKISH_CHARSET, 160, 250, 650, 550 );

    HotPDF.AddPage;
    //---------------------------  Text Scaling   --------------------------//
    HotPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 20);
    OutlineRoot.AddChild( 'Text Scaling', 200, 30 );
    HotPDF.CurrentPage.TextOut( 180, 30, 0, 'Horizontal text scaling' );
    ShowTable(130, 70);
    HotPDF.CurrentPage.SetFont('Times New Roman', [], 12);
    HotPDF.CurrentPage.TextOut( 160, 90, 0, 'default 100' );
    HotPDF.CurrentPage.TextOut( 165, 135, 0, 'set to 50' );
    HotPDF.CurrentPage.SetFont('Times New Roman', [], 24);
    HotPDF.CurrentPage.TextOut( 280, 85, 0, 'Word' );
    HotPDF.CurrentPage.SetHorizontalScaling( 50 );
    HotPDF.CurrentPage.TextOut( 285, 130, 0, 'Word' );
    HotPDF.CurrentPage.SetHorizontalScaling( 100 );

    //---------------------------  Character Spacing   --------------------------//
    HotPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 20);
    OutlineRoot.AddChild( 'Character Spacing', 200, 190 );
    HotPDF.CurrentPage.TextOut( 200, 190, 0, 'Character Spacing' );
    ShowTable(130, 230);
    HotPDF.CurrentPage.SetFont('Times New Roman', [], 12);
    HotPDF.CurrentPage.TextOut( 162, 250, 0, 'default 0' );
    HotPDF.CurrentPage.TextOut( 162, 298, 0, 'set space 5' );
    HotPDF.CurrentPage.SetFont('Times New Roman', [], 24);
    HotPDF.CurrentPage.TextOut( 278, 243, 0, 'Character' );
    HotPDF.CurrentPage.SetCharacterSpacing( 5 );
    HotPDF.CurrentPage.TextOut( 278, 290, 0, 'Character' );
    HotPDF.CurrentPage.SetCharacterSpacing( 0 );

    //---------------------------  Word Spacing   --------------------------//
    HotPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 20);
    OutlineRoot.AddChild( 'Word Spacing', 200, 350 );
    HotPDF.CurrentPage.TextOut( 200, 350, 0, 'Word Spacing' );
    ShowTable(130, 390);
    HotPDF.CurrentPage.SetFont('Times New Roman', [], 12);
    HotPDF.CurrentPage.TextOut( 162, 410, 0, 'default 0' );
    HotPDF.CurrentPage.TextOut( 162, 460, 0, 'set space 10' );
    HotPDF.CurrentPage.SetFont('Times New Roman', [], 24);
    HotPDF.CurrentPage.TextOut( 280, 400, 0, 'Word Space' );
    HotPDF.CurrentPage.SetWordSpacing( 10 );
    HotPDF.CurrentPage.TextOut( 280, 450, 0, 'Word Space' );
    HotPDF.CurrentPage.SetWordSpacing( 0 );

    //---------------------------  Rendering modes   --------------------------//
    HotPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 20);
    OutlineRoot.AddChild( 'Rendering Modes', 200, 520 );
    HotPDF.CurrentPage.TextOut( 200, 520, 0, 'Rendering Modes' );
    HotPDF.CurrentPage.Rectangle( 50, 560, 500, 150 );
    HotPDF.CurrentPage.Stroke;
    HotPDF.CurrentPage.MoveTo( 175, 560 );
    HotPDF.CurrentPage.LineTo( 175, 710 );
    HotPDF.CurrentPage.Stroke;
    HotPDF.CurrentPage.MoveTo( 300, 560 );
    HotPDF.CurrentPage.LineTo( 300, 710 );
    HotPDF.CurrentPage.Stroke;
    HotPDF.CurrentPage.MoveTo( 425, 560 );
    HotPDF.CurrentPage.LineTo( 425, 710 );
    HotPDF.CurrentPage.Stroke;
    HotPDF.CurrentPage.MoveTo( 50, 625 );
    HotPDF.CurrentPage.LineTo( 550, 625 );
    HotPDF.CurrentPage.Stroke;

    HotPDF.CurrentPage.SetFont('Arial', [], 12);
    HotPDF.CurrentPage.TextOut( 100, 580, 0, 'Fill');
    HotPDF.CurrentPage.TextOut( 215, 580, 0, 'Stroke');
    HotPDF.CurrentPage.TextOut( 320, 580, 0, 'Fill Stroke');
    HotPDF.CurrentPage.TextOut( 465, 580, 0, 'Invisible');

    HotPDF.CurrentPage.SetFont('Arial', [fsBold], 72);
    HotPDF.CurrentPage.SetRGBStrokeColor ( clRed );
    HotPDF.CurrentPage.SetRGBFillColor ( clYellow );

    HotPDF.CurrentPage.SetTextRenderingMode( trFill );
    HotPDF.CurrentPage.TextOut( 90, 630, 0, 'P');
    HotPDF.CurrentPage.SetTextRenderingMode( trStroke );
    HotPDF.CurrentPage.TextOut( 215, 630, 0, 'D');
    HotPDF.CurrentPage.SetTextRenderingMode( trFillThenStroke );
    HotPDF.CurrentPage.TextOut( 340, 630, 0, 'F');
    HotPDF.CurrentPage.SetTextRenderingMode( trInvisible ); 
    HotPDF.CurrentPage.TextOut( 475, 630, 0, 'X');
    HotPDF.CurrentPage.SetTextRenderingMode( trFillThenStroke );

    HotPDF.EndDoc;
  finally
    HotPDF.Free;
  end;
end.

HotPDF Hello World Sample

Hello world from Delphi HotPDF Component!

program HelloWorld;
{$APPTYPE CONSOLE}
uses
  Windows, Messages, SysUtils, Vcl.Graphics, Classes, HPDFDoc;
var
  HotPDF: THotPDF;
  Titles: TStrings;
  Title:  String;
  Window: HWND;
begin
  // Close destination PDF file if opened in Adobe or Fixit PDF readers & editors.
  Titles := TStringList.Create;
  Titles.CommaText := '"HelloWorld.pdf", "HelloWorld.pdf - Foxit Reader", "HelloWorld.pdf - Foxit PhantomPDF"';

  for Title in Titles do
  begin
    Window := FindWindow(Nil, PChar(Title));
    while Window <> 0 do
    begin
      postmessage(Window, WM_CLOSE, 0, 0);
      Window := FindWindowEx(0, Window, Nil, PChar(Title));
    end;
  end;
  Titles.Free;

  // Create HelloWorld.pdf and write something
  HotPDF:= THotPDF.Create(nil);
  try
    HotPDF.AutoLaunch := true;
    HotPDF.FileName := 'HelloWorld.pdf';
    HotPDF.BeginDoc;
    HotPDF.CurrentPage.SetFont('Arial Unicode MS', [], 12, 0, False);
    HotPDF.CurrentPage.TextOut(80, 50, 0, 'Hello, Delphi PDF world!');
    HotPDF.CurrentPage.TextOut(80, 70, 0, 'Hola, mundo Delphi PDF!');
    HotPDF.CurrentPage.TextOut(80, 90, 0, 'Hallo, Delphi PDF Welt!');
    HotPDF.CurrentPage.TextOut(80, 110, 0, 'Bonjour, monde PDF Delphi!');
    HotPDF.CurrentPage.TextOut(80, 130, 0, 'Ciao, mondo Delphi PDF!');
    HotPDF.CurrentPage.UnicodeTextOut(80, 150, 0, 'Olá, mundo Delphi PDF!');
    HotPDF.CurrentPage.UnicodeTextOut(80, 170, 0, 'Здравствуйте, Delphi PDF мир!');
    HotPDF.CurrentPage.UnicodeTextOut(80, 190, 0, 'こんにちは、Delphi PDFの世界!');
    HotPDF.CurrentPage.UnicodeTextOut(80, 210, 0, 'Merhaba, Delphi PDF dünyası!');
    HotPDF.CurrentPage.UnicodeTextOut(80, 230, 0, '你好,Delphi PDF世界');
    HotPDF.CurrentPage.SetFont('Malgun Gothic Semilight', [], 12, 0, False);
    // Set font for Korean text displaying
    HotPDF.CurrentPage.UnicodeTextOut(80, 250, 0, '여보세요, Delphi PDF 세계!');
    HotPDF.EndDoc;
  finally
    HotPDF.Free;
  end;
end.