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.

losLab

Devoted to developing PDF and Spreadsheet developer library, including PDF creation, PDF manipulation, PDF rendering library, and Excel Spreadsheet creation & manipulation library.