How to Integrate PDF Creator Pilot Library into Your Application: A Step-by-Step Tutorial for C++, C#, VB, VB.NET, VBScript, Delphi.


PDF Creator Pilot:       Home       Download       Features       Tutorials       FAQ       Pricing       News

 

In this guide, we’ll walk you through the process of adding PDF Creator Pilot to your project and creating a new PDF document.

Adding PDF Creator Pilot library to you project


For Microsoft Visual Studio (.NET):

Add a reference to PDF Creator Pilot to be able to use pdf library in .NET projects. Select “Project” in main menu and click “Add Reference”:

Click Add Reference

Switch to “COM” tab and find PDF Creator Pilot in the list of available COM objects:

Find PDF Creator Pilot in the list of available COM objects

Visual Studio will create Interop wrappers needed for PDF Creator Pilot could be used in your code.
 

For Microsoft Visual Studio (C++):

Just add these lines to your code:

#import "PDFCreatorPilot.dll"
using namespace PDFCreatorPilotLib;

Now you may use PDF Creator Pilot like any other ActiveX conponent.
 

For Delphi:

Select “Project” -> “Import Type Library” command as shown below:

Select Import Type Library command

The import dialog will appear. Find and select PDF Creator Pilot in the libraries list and press “Install…” button:

Find and select PDF Creator Pilot in the libraries list

Delphi will suggest you to install PDF Creator Pilot into the user component package and the Install dialog will appear:

The Install dialog appears

Press OK and confirm it by pressing Yes. Delphi will recompile user components package and PDF Creator Pilot will be installed on the “ActiveX” components page.

Now you may use PDF Creator Pilot like any other component.
 

Creating a PDF document


Each session with PDF documents contains the following steps:

1. Your programming language must initialize the PDF Creator Pilot run-time library, as follows.

VB.NET

Dim PDF As PDFCreatorPilotLib.PDFDocument4
' create pdf library object
 PDF = New PDFCreatorPilotLib.PDFDocument4
' initialize PDF Engine

C/C++

IPDFDocument4* PDF = NULL;
CLSID clsid;
 
HRESULT hr = CLSIDFromProgID(OLESTR("PDFCreatorPilot.PDFDocument4"), &clsid);
if(hr != S_OK)
{
    // can't load. no such COM installed.
    return;
}
 
hr = CoCreateInstance(clsid, 0, CLSCTX_ALL, __uuidof(IPDFDocument4), (LPVOID *)&PDF);
if(hr != S_OK)
{
    // can't load. no such COM installed.
    return;
}

C#

/*
PDFCreatorPilot must be added to project as reference
(in the COM tab page).
*/
 
PDFCreatorPilotLib.PDFDocument4Class PDF = new PDFCreatorPilotLib.PDFDocument4Class();
 
/* Starting from .Net v. 4.0 you can't use interop classes
   so use interface PDFCreatorPilotLib.PDFDocument4 instead of class PDFCreatorPilotLib.PDFDocument4Class:
 
PDFCreatorPilotLib.PDFDocument4 PDF = new PDFCreatorPilotLib.PDFDocument4();
*/

This step makes the run-time library active and creates a new object: PDF document.

Visual Basic or Visual Basic Script

Set PDF = CreateObject("PDFCreatorPilot.PDFDocument4")

Delphi

Just drag a component TPDFDocument4 from your ActiveX panel to a form. Or manualy create a variable and initialize it:

{ Select menu Project -> Import Type Library
  Find "PDFCreatorPilot Type Library (Version 1.0)".
  Import this type library.
  Add PDFCreatorPilotLib_TLB in the "uses" section.
  Add line:
    PDF: TPDFDocument4;
  in the "var" section.
}
 
uses
  PDFCreatorPilotLib_TLB, ...
 
{...}
 
var
  PDF: TPDFDocument4;
{...}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  PDF := TPDFDocument4.Create(nil);
  {...}
end;

 

2. You must start the PDF engine using the SetLicenseData method and optional correct license parameters, if you have one.

VB.NET

PDF.SetLicenseData("demo@demo", "demo")

C/C++

PDF->SetLicenseData("demo@demo", "demo");

C#

PDF.SetLicenseData("demo@demo", "demo");

Visual Basic or Visual Basic Script

PDF.SetLicenseData "demo@demo", "demo"

Delphi

PDF.SetLicenseData('demo@demo', 'demo');

 

3. The next step is to set up PDF document parameters, like title, and so forth.

VB.NET

PDF.SetTitle("PDF Creator Pilot Demo", 
PDFCreatorPilotLib.fontCharset.fcANSI)
PDF.ProducePDFA = False
PDF.Compression = 1

C/C++

PDF->SetTitle("PDF Creator Pilot Demo", fcANSI);
PDF->ProducePDFA = false;
PDF->Compression = coFlate;

C#

PDF.SetTitle("PDF Creator Pilot Demo", FontCharset.fcANSI);
PDF.ProducePDFA = false;
PDF.Compression = CompressionType.coFlate;

Visual Basic or Visual Basic Script

PDF.SetTitle "PDF Creator Pilot Demo", 1 'FontCharset.fcANSI
PDF.ProducePDFA = False
PDF.Compression = 1 'coFlate

Delphi

PDF.SetTitle('PDF Creator Pilot Demo', fcANSI);
PDF.ProducePDFA := false;
PDF.Compression := coFlate;

See descriptions of the following “document-dependent” methods: Title, Compression, ProducePDFA.
 

4. Complete the action you want in the PDF workplace: write text, draw objects, create new pages. See all method groups for a full description of IPDFDocument4.
 

5. Finalize your work with SaveToFile or GetBuffer methods.

VB.NET

' finalize document generation
PDF.SaveToFile("TestVB.PDF", True)

C/C++

PDF->SaveToFile("test.pdf", false);

C#

PDF.SaveToFile("test.pdf", false);

Visual Basic or Visual Basic Script

PDF.SaveToFile "test.pdf", false

Delphi

PDF.SaveToFile('test.pdf', dfalse);

 

See also:

 


PDF Creator Pilot:       Home       Download       Features       Tutorials       FAQ       Pricing       News