Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
PDF Creator Pilot 3 Knowledge Base
How to Create a New PDF Document

See Also
Collapse All

First, add the PDF Creator Pilot library to your project.

For Delphi:

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

The Import Type Library dialog will appear. Find and select PDF Creator Pilot in the libraries list and click the "Install..." button:

Delphi will suggest that you install PDF Creator Pilot into the user component package, and the Install dialog will appear.

Click OK and then confirm your choice by clicking Yes. Delphi will recompile the user components package and PDF Creator Pilot will be installed as TpiPDFDocument component on the "ActiveX" components page.

Now you may use TpiPDFDocument like any other component.

For Microsoft Visual Studio (C++):

Add these lines to your code:

#import "PDFCreatorPilot3.dll"
using namespace PDFCreatorPilot3Lib;

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

For Microsoft Visual Studio (.NET):

Add a reference to PDF Creator Pilot to be able to use the PDF library in your C#.NET project. Select Project in main menu and click Add Reference:

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

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

Creating a PDF document requires the following steps:

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

Delphi :

Drag a TPDFDocument3 component from your ActiveX panel to a form,
or manually 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: TPDFDocument3;
  in the "var" section.
}

uses
  PDFCreatorPilotLib_TLB

{...}

var
  PDF: TPDFDocument3;
{...}

procedure TForm1.Button1Click(Sender: TObject);
begin
  PDF := TPDFDocument3.Create(nil);
  {...}
end;

Visual Basic or Visual Basic Script :

Set PDF = CreateObject("PDFCreatorPilot.PDFDocument3")

C/C++ :

IPDFDocument3* PDF = NULL;
CLSID clsid;

HRESULT hr = CLSIDFromProgID(OLESTR("PDFCreatorPilot.PDFDocument3"), &clsid);
if(hr != S_OK)
{
    // can't load. no such COM installed.
    return;
}

hr = CoCreateInstance(clsid, 0, CLSCTX_ALL, __uuidof(IPDFDocument3), (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.PDFDocument3Class PDF = new PDFCreatorPilotLib.PDFDocument3Class();

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

2. You must start the PDF engine using the StartEngine method and set any optional license parameters, if you have a license that requires them.

Delphi :

PDF.StartEngine 'demo@demo', 'demo'

Visual Basic or Visual Basic Script :

PDF.StartEngine "demo@demo", "demo"

C/C++ :

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

C# :

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

3. Set up PDF document parameters, such as file name, creation date, title, and so forth.

Delphi :

PDF.DocumentInfo_CreationDate := StrToDateTime('28.05.2008 10:02');
PDF.Filename := 'c:\demo.pdf';
PDF.DocumentInfo_Title := 'PDF Creator Pilot Demo';
PDF.AutoLaunch := true;
PDF.Compression := ctFlate;

Visual Basic or Visual Basic Script :

PDF.DocumentInfo_CreationDate = Now
PDF.Filename = "c:\demo.pdf"
PDF.DocumentInfo_Title = "PDF Creator Pilot Demo"
PDF.AutoLaunch = True
PDF.Compression = 1

C/C++ :

PDF->DocumentInfo_CreationDate = COleDateTime::GetCurrentTime().m_dt;
PDF.Filename = "c:\\demo.pdf";
PDF.DocumentInfo_Title = "PDF Creator Pilot Demo";
PDF.AutoLaunch = TRUE;
PDF.Compression = ctFlate;

C# :

PDF.DocumentInfo_CreationDate = DateTime.Now;
PDF.Filename = @"c:\demo.pdf";
PDF.DocumentInfo_Title = "PDF Creator Pilot Demo";
PDF.AutoLaunch = true;
PDF.Compression = TxCompressionType.ctFlate;

See descriptions of the following "document-dependent" methods: AutoLaunch, DocumentInfo_Title, FileName, FontEmbedStyle, ProtectionEnabled.

4. Run BeginDoc to start working with the PDF object.

Delphi :

PDF.BeginDoc;

Visual Basic or Visual Basic Script :

PDF.BeginDoc

C/C++ :

PDF->BeginDoc();

C# :

PDF.BeginDoc();

5. Complete the action you want in the PDF workplace: write text, draw objects, create new pages. See all method groups for a full description: General methods, Draw methods, Outlines, Annotations.

6. Finalize your work with EndDoc. This makes a real PDF file, unless you use  GenerateInMemoryFile.

Delphi :

PDF.EndDoc;

Visual Basic or Visual Basic Script :

PDF.EndDoc

C/C++ :

PDF->EndDoc();

C# :

PDF.EndDoc();

See Also

Reference

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots