Getting Started
Installation, Delphi setup, First program
PDF Library for Delphi 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 PDF Library for Delphi 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 i386-win32, or x86_64-win64 in a binary package. The main class is
build-Lazarus-Lib.cmd win32
build-Lazarus-Tests.cmd win32
build-Lazarus-Demo.cmd win32
build-Lazarus-Lib.cmd win64
debugnorunFPCfpc.exe
Lib\FPC\i386-win32Lib\FPC\x86_64-win64Lib\FPC\compatLib\thirdpartyLib\FPC\PDFlibPasLaz.lpk
Tests\Lazarus\bin\<target>bin\<target>Lib\thirdparty\Win32fPDFlibJBIG2EncC
build-Lazarus-Demo-TRIAL.cmd win32win64build-Lazarus-Lib-TRIAL.cmd win32win64
Class and Unit Name
PDFlibrary.pasPDFlibrary.dcuTPDFlib.
Declare the Class
PDF Library for Delphi 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 PDF Library for Delphi 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;
Complete Workflows
After the first PDF, explore the bundled Demo/Delphi, Demo/C++Builder or Demo/Lazarus portfolio: Showcase provides a visual tour, whilst each domain Lab exposes specialist scenarios from one executable
Run DocumentLab --scenario DocumentInspectionWorkbench for page inventories and diagnostic reports, or supply your own PDF using the scenario's documented command-line arguments
Run ContentLab --scenario WorkflowGallery for a document delivery workflow with tables, annotations, a handover checklist, HTTP output and saved-file verification
DLL users can start with Demo/CSharp/DLL/WorkflowWorkbench or Demo/VB.NET/DLL/WorkflowWorkbench for report generation, extraction, page composition and binary memory transfer, or Demo/VC++/DLL/LinkDemo for verified links and navigation
Open Demo/DLL.en-us.html in the installed package for the DLL workflow catalogue and architecture-specific build instructions
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 PDF Library for Delphi product page.