Getting Started: Delphi Edition
Installation
Copy all the DCU and RES files from the relevant installation folder into a directory of your choice.
The default installation folder is: C:\Program Files\Debenu\PDF Library\
Setting the path
You must tell Delphi where to look for the DCU files. You can either do this once by setting your "Library Path", or you can set the "Search Path" of each of your projects individually.
To set your Library Path, use the Delphi menu:
Tools | Environment Options | Library | Library path
If you would prefer to set your project's Search Path, use the following Delphi menu:
Projects | Options | Directories/Conditionals | Search path
Class/unit name
The class name of Debenu Quick PDF Library Delphi Edition is "TDebenuPDFLibrary" followed by the version number. The unit name is the same but without the leading T. For example, in this release the full class name is TDebenuPDFLibrary1011 and the unit is DebenuPDFLibrary1011.
Instantiating the class
Debenu Quick PDF Library is a class, not a component. The software does not get installed into the Delphi IDE and you do not place a component onto a form. Instead, you create an instance of the component whenever you need to, much like other VCL classes (for example TStringList or TFileStream).
Simply add the Debenu Quick PDF Library unit DebenuPDFLibrary1011 to the uses clause, declare a variable of type TDebenuPDFLibrary1011, and call the Create class function.
When you are finished using the class, call the Free function, usually within a try...finally block.
The first function you should call is the UnlockKey function, passing it your license key.
Your first Debenu Quick PDF Library program
Start a new Delphi project. If your Delphi environment gives you the option, choose a VCL Forms application.
Add a TButton, a TMemo and a TLabel component onto your form.
Add Debenu Quick PDF Library's unit (DebenuPDFLibrary1011) to the uses clause of your form unit:
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, DebenuPDFLibrary1011;
Double-click the TButton to add an OnClick event, and fill in the following event code. Change the path in the SaveToFile function to an existing folder on your computer.
var
PDFLibrary: TDebenuPDFLibrary1011;
UnlockResult: Integer;
begin
PDFLibrary := TDebenuPDFLibrary1011.Create;
try
UnlockResult := PDFLibrary.UnlockKey(Edit1.Text);
Label1.Caption := PDFLibrary.LicenseInfo;
if UnlockResult = 1 then
begin
PDFLibrary.DrawText(100, 500, 'Hello from Delphi');
PDFLibrary.SaveToFile('C:\Docs\HelloFromDelphi.pdf');
end else
begin
ShowMessage('Invalid license key);
end;
finally
PDFLibrary.Free;
end;
end;
You can now run your program. Fill your Debenu Quick PDF Library license key into the edit box and then click the button.
If the license key you put into Edit1 is valid, the call to the UnlockKey function will return the value 1 and a PDF will be created in the specified directory.