Getting Started: LIB Edition


The LIB Edition of Quick PDF Library is generated automatically by converting the DLL Edition into a static link library.

The static link library file is called DebenuPDFLibraryLIB1212.lib and a header file called DebenuPDFLibraryLIB1212.h is included.

Link dependencies

The following resource files must be linked into the final executable:


The following import libraries must be added to your project:


In previous versions of the library, these import libraries were also required: MSVCRT.LIB, VERSION.LIB, COMCTL32.LIB but from version 8.15 they are no longer needed.


Initializing/releasing the library

The DEBENUPDFLIBRARYLIB1212_DllMain function should be called once before using any of the other functions, using the DLL_PROCESS_ATTACH constant for the fdwReason parameter.

The DPLCreateLibrary function must be called to initialize the library. An InstanceID will be returned which must be passed as the first parameter to all the other functions.

When you are finished with the library, call DPLReleaseLibrary to release all allocated memory.

Finally, before the application ends the DEBENUPDFLIBRARYLIB1212_DllMain function should be called again. This time the DLL_PROCESS_DETACH constant should be used.

Unlocking the library

Once you have an InstanceID, you should call the DebenuPDFLibraryUnlockKey function, passing it your license key, to unlock the library.

int InstanceID = DebenuPDFLibraryCreateLibrary();
if (DebenuPDFLibraryUnlockKey(InstanceID, L”your license key”) == 1) {
DPLDrawText(InstanceID, 100, 500, L”Hello world”);
DPLSaveToFile(InstanceID, L”C:\\Docs\\HelloFromLIB.pdf”);

If you are linking the LIB file to a DLL and not an EXE file then you need to change the GetModuleHandle(NULL) reference to GetModuleHandle(“mydllname”) so that it can correctly load the resources from the DLL.

  DEBENUPDFLIBRARYLIB1212_DllMain(GetModuleHandle(“mydllname”), DLL_PROCESS_ATTACH, NULL);
int InstanceID = DebenuPDFLibraryCreateLibrary();
if (QuickPDFUnlockKey(InstanceID, L”your license key”) == 1) {
DPLDrawText(InstanceID, 100, 500, L”Hello world”);
DPLSaveToFile(InstanceID, L”C:\\Docs\\HelloFromLIB.pdf”);
DEBENUPDFLIBRARYLIB1212_DllMain(GetModuleHandle(“mydllname”), DLL_PROCESS_DETACH, NULL);


Sending strings to Quick PDF Library

Most Quick PDF Library string parameters are defined as PWideChars, which are pointers to 16-bit null-terminated Unicode strings (UTF-16BE).

Some functions accept 8-bit binary data. If the data you need to send to the library may contain null characters, you can ask Quick PDF Library to create a temporary buffer of a certain size.

Use the DPLCreateBuffer and DPLAddToBuffer functions to create the buffer and fill it with data. The value returned by the DPLCreateBuffer function can then be used for any 8-bit or 16-bit string parameter:

  char * Buffer;
char * Content = …;  // pointer to the data
Buffer = DPLCreateBuffer(10000);
DPLAddToBuffer(InstanceID, Buffer, Content, 10000);
“MyData”, Buffer, 1, 0);
DPLReleaseBuffer(InstanceID, Buffer);

Receiving strings from Quick PDF Library

Most functions that return string data will return a PWideChar, a pointer to a Unicode string. The memory for this string is contained within the Quick PDF Library instance.

The data in the string should be copied out immediately as the same memory will be used for subsequent calls to the library.

To get the length of the returned string, use the DPLStringResultLength function. This function returns the number of Unicode characters (multiply by 2 to get the size in bytes).

Some functions may return data that contains 8-bit data, possibly including null characters.

To get the length of the binary data, use the DPLAnsiStringResultLength function:

  char * Content;
int ContentLength;
Content = DPLRetrieveCustomDataToString(InstanceID,
“MyData”, 1);
ContentLength = DPLAnsiStringResultLength(InstanceID);
// copy the data in Content now