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
The class name of 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 TDebenuPDFLibrary1411 and the unit is DebenuPDFLibrary1411.
Instantiating the class
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 Quick PDF Library unit DebenuPDFLibrary1411 to the uses clause, declare a variable of type TDebenuPDFLibrary1411, 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 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 Quick PDF Library’s unit (DebenuPDFLibrary1411) to the uses clause of your form unit:
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DebenuPDFLibrary1411;
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.
procedure TForm1.Button1Click(Sender: TObject); var PDFLibrary: TDebenuPDFLibrary1411; UnlockResult: Integer; begin PDFLibrary := TDebenuPDFLibrary1411.Create; try UnlockResult := PDFLibrary.UnlockKey(Edit1.Text); Label1.Caption := PDFLibrary.LicenseInfo; if UnlockResult = 1 <b>then</b> 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 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.