Click or drag to resize

Initialize Library

This topic contains the following sections:

Overview

It is necessary for applications to initialize SDK before calling any APIs. The method PdfCommon.Initialize(string licenseKey, string specificPath, string icuSpecificPath) is provided to initialize SDK. When there is no need to use SDK any more, please call PdfCommon.Release to release it.

The initialization method takes three parameters: the licenseKey, the specificPath and the icuSpecificPath. Each of them can be null or omitted.

If the licenseKey is null or omitted, the SDK will be initialized in evaluation mode. In this mode, the SDK works as a full SDK. To switch it to the Lite Edition, you must use a temporary Lite key. Please read this article for details: SDK Lite

The Initialize method internally loads pdfium.dll (libpdfium.dylib on Mac OS) into the process's address space. Conversely, PdfCommon.Release unloads pdfium.dll. PdfCommon.Initialize should be called once per process. The second call does nothing but increment the internal counter. Thus, if you call PdfCommon.Initialize twice, you must also call PdfCommon.Release twice.

Tip  Tip

In web applications, a process is an application pool, so if you have multiple web applications hosted in the same application pool, the SDK will be initialized / de-initialized for all of them.

You can move pdfium.dll to your own folder. In this case, you need to specify exactly where this dll is located. You can specify the full path to pdfium.dll via the specificPath parameter. Similarly, the path to the icudt.dll is indicated through the icuSpecificPath parameter.

Important note  Important

Note! dll can be moved, but not renamed. Both libraries should be named pdfium.dll and icudt.dll respectively.

On Mac OS, the specificPath and icuSpecificPath parameters are ignored, and moving of libpdfium.dylib is impossible.

Example

Initialize SDK in evaluation mode

C#
PdfCommon.Initialize();

Initialize SDK in registered mode

C#
string key = "4243355-3494d500-328bd02-...";
PdfCommon.Initialize(key);

Initialize SDK in evaluation mode with the path to pdfium.dll and to icudt.dll

C#
PdfCommon.Initialize(null, @"c:\pdfium.dll", @"c:\icudt.dll");
See Also