Unit MainForm;

{$I ..\..\..\Lib\PDFlibDefines.inc}

Interface

Uses
{$IFDEF XE2+}
  Winapi.Windows,
  Winapi.ShellAPI,
  System.Classes,
  Vcl.Controls,
  Vcl.StdCtrls,
  Vcl.Forms,
{$ELSE}
  Windows,
  ShellAPI,
  Classes,
  Controls,
  StdCtrls,
  Forms,
{$ENDIF}
  PDFlibrary;

Type
  TForm1 = Class(TForm)
    Button1: TButton;
    Procedure Button1Click(Sender: TObject);
  Private
    { Private declarations }
  Public
    { Public declarations }
  End;

Var
  Form1: TForm1;

Implementation

{$R *.dfm}

Procedure TForm1.Button1Click(Sender: TObject);
Begin
  With TPDFlib.Create Do
    Try

      SetOrigin(1); // set top left mode

      AddTrueTypeFont('Calibri {1250}', 0);
      // Windows-1250 is a code page used under Windows to represent texts in Central European and Eastern European languages
      // https://en.wikipedia.org/wiki/Windows-1250
      DrawText(20, 40, 'Polish: przyjęcie materiału - AddTrueTypeFont, Windows-1250 Central/Eastern European ');

      // Or add only needed characters to SubsetChars of AddSubsettedFont
      AddSubsettedFont('Calibri', 16, 'AĄBCĆDEĘFGHIJKLŁMNŃOÓPRSŚTUVWXYZŹŻaąbcćdeęfghijklłmnńoóprsśtuvwxyzźż0123456789`~!@#$%^&*()-_=+[{]}\|;:",<.>/?' +
        #9#32#39);
      DrawText(20, 60, 'Polish: przyjęcie materiału - AddSubsettedFont, CharSetIndex 16 East Europe');

      // Or add only needed characters to SubsetChars of AddTrueTypeSubsettedFont
      AddTrueTypeSubsettedFont('Calibri', 'AĄBCĆDEĘFGHIJKLŁMNŃOÓPRSŚTUVWXYZŹŻaąbcćdeęfghijklłmnńoóprsśtuvwxyzźż0123456789`~!@#$%^&*()-_=+[{]}\|;:",<.>/?' +
        #9#32#39, 1);
      DrawText(20, 80, 'Polish: przyjęcie materiału - AddTrueTypeSubsettedFont, Option 1 Unicode, don''t care charset');

      // Attempt to save the file
      SaveToFile('UnicodeText.pdf');
      ShellExecute(Handle, 'open', 'UnicodeText.pdf', Nil, Nil, SW_SHOWNORMAL);
    Finally
      Free;
    End;

End;

End.
