Getting Started

Installation, Delphi setup, First program

PDFlibPas is a Delphi PDF library. It is used from code by adding the library unit to your project and creating a TPDFlib instance when you need to build or modify a PDF document.

Path Setting

Tell Delphi where to find the PDFlibPas source files or compiled DCU files. You can set the global Library Path once, or set the Search Path for each project that uses the library.

To set the global Library Path, use this Delphi menu path:

Tools -> Options -> Language -> Delphi -> Library -> Library path

For older Delphi releases this setting may appear under:

Tools -> Environment Options -> Library -> Library path

Add the installed source path or the matching compiled binary path. Examples:

%UserProfile%\Documents\losLab\PDFlibPas\Lib
%UserProfile%\Documents\losLab\PDFlibPas\Lib\37.0\Win32\Release
%UserProfile%\Documents\losLab\PDFlibPas\Lib\37.0\Win64\Release

The first path is the default source edition path. The versioned paths are examples for RAD Studio 13 Florence compiled DCUs. Use the BDS-version folder that matches your installed Delphi or C++Builder version.

To set only the current project's Search Path, use:

Project -> Options -> Building -> Delphi Compiler -> Search path

For older Delphi releases this setting may appear under:

Project -> Options -> Directories/Conditionals -> Search path

Class and Unit Name

The main library unit is PDFlibrary.pas, or PDFlibrary.dcu in a binary package. The main class is TPDFlib.

Declare the Class

PDFlibPas is a Delphi library, not a VCL component. It is not installed onto the IDE component palette. Add PDFlibrary to the unit's uses clause, declare a variable of type TPDFlib, and call the Create constructor. When you are finished, call Free, normally inside a try..finally block.

First PDF Library Program

Start a new VCL Forms application and add a TButton to the form. Add the PDFlibPas unit to the form unit:

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, PDFlibrary;

Double-click the button and add this event handler:

procedure TForm1.Button1Click(Sender: TObject);
var
  PDFlib: TPDFlib;
begin
  PDFlib := TPDFlib.Create;
  try
    PDFlib.DrawText(100, 500, 'Hello from Delphi');
    PDFlib.SaveToFile('.\HelloFromDelphi.pdf');
  finally
    PDFlib.Free;
  end;
end;

More Information

Use this HTML reference for detailed API documentation. You can search the navigation pane by function name, category, or topic keyword.

For product news and additional information, visit the PDFlibPas product page.