17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3 <strong>COM</strong> Binding<br />

<strong>COM</strong> (Component Object Model) 1 is a language-independent standard for interoperable<br />

software components. The <strong>COM</strong> implementation of <strong>PDFlib</strong> is built as a DLL based on the<br />

<strong>PDFlib</strong> core. The wrapper DLL calls the <strong>PDFlib</strong> core functions and is responsible for communicating<br />

with the underlying <strong>COM</strong> machinery, registration and type library issues,<br />

and <strong>COM</strong> exception handling. The <strong>PDFlib</strong> <strong>COM</strong> wrapper can technically be characterized<br />

as follows (don’t worry if you are not familiar with all of these terms – they are not required<br />

for using <strong>PDFlib</strong>):<br />

> <strong>PDFlib</strong> acts as a Win32 in-process <strong>COM</strong> server component (also known as an automation<br />

server) without any user interface.<br />

> <strong>PDFlib</strong> is a »both-threaded« component, i.e., it is treated as both an apartmentthreaded<br />

as well as a free-threaded component. In addition, <strong>PDFlib</strong> aggregates a freethreaded<br />

marshaller. In simple terms, clients can use the <strong>PDFlib</strong> object directly (instead<br />

of going through a proxy/stub pair) which boosts performance.<br />

> The <strong>PDFlib</strong> binary pdflib_com.dll is a self-registering DLL with a type library.<br />

> <strong>PDFlib</strong> is stateless, i.e., method parameters are used instead of properties.<br />

> <strong>PDFlib</strong>’s dual interface supports both early and late binding.<br />

> <strong>PDFlib</strong> supports rich error information.<br />

Note <strong>PDFlib</strong> is not MTS-aware (Microsoft Transaction Server), although it can be deployed with MTS.<br />

Installing the <strong>PDFlib</strong> <strong>COM</strong> edition. <strong>PDFlib</strong> can be deployed in all environments that<br />

support <strong>COM</strong> components. We will demonstrate our examples in several environments:<br />

> Visual Basic<br />

> Active Server Pages (ASP) with JScript<br />

> <strong>Windows</strong> Script Host (WSH) with VBScript<br />

> Borland Delphi<br />

Active Server Pages and <strong>Windows</strong> Script Host both support JScript and VBScript. Since<br />

the scripts are nearly identical, however, we do not demonstrate all combinations here.<br />

In addition, there are many other <strong>COM</strong>-aware development environments available –<br />

Microsoft Visual C++, Borland C++ Builder, PowerBuilder, to name but a few. <strong>PDFlib</strong> also<br />

works in Visual Basic for Applications (VBA).<br />

Installing <strong>PDFlib</strong> is an easy and straight-forward process. Please note the following:<br />

> If you install on an NTFS partition all <strong>PDFlib</strong> users must have read permission to the<br />

installation directory, and execute permission to ...\<strong>PDFlib</strong> 8.0.6\bin\pdflib_com.dll.<br />

> The installer must have write permission to the system registry. Administrator or<br />

Power Users group privileges will usually be sufficient.<br />

The <strong>PDFlib</strong> MSI installer. <strong>PDFlib</strong> is available as an MSI package (Microsoft’s <strong>Windows</strong><br />

Installer) which supports installation, repair, and uninstall features. To install <strong>PDFlib</strong><br />

from the MSI package simply double-click on the .msi file, or right-click on it and choose<br />

install.<br />

If your system does not support MSI (like <strong>Windows</strong> NT) you can get MSI support for<br />

free from Microsoft.<br />

The installation programs supplied for the <strong>PDFlib</strong> <strong>COM</strong> component automatically<br />

takes care of all issues related to using <strong>PDFlib</strong> with <strong>COM</strong>. For the sake of completeness,<br />

1. See www.microsoft.com/com for more information about <strong>COM</strong><br />

2.3 <strong>COM</strong> Binding 29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!