1. Home
  2. Foxit Quick PDF Library
  3. Getting Started Guide for Foxit Quick PDF Library (DLL Edition)

Getting Started Guide for Foxit Quick PDF Library (DLL Edition)

Installation

Included with the single DLL file DebenuPDFLibraryDLL1411.dll are various header/import files. They provide an easier way to interface with Quick PDF Library. Technical details of the interface are provided here.

Initializing/release the library

All functions in the DLL use the stdcall convention. 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.

Unlocking the library

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

int InstanceID;
InstanceID = DPLCreateLibrary();
if (DPLUnlockKey(InstanceID, “your license key”) == 1) {
  DPLDrawText(InstanceID, 100500, “Hello world”);
  DPLSaveToFile(InstanceID, “C:\Docs\HelloFromDLL.pdf);
}
DPLReleaseLibrary(InstanceID);

Sending strings to Foxit Quick PDF Library

Quick PDF Library string parameters are mostly defined as PWideChars, which are pointers to 16-bit null-terminated Unicode strings. Some functions expect a pointer to an 8-bit data block (the functions that end with “FromString”).

If you need to send binary data to Foxit Quick PDF Library that 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 Quick PDF Library string parameter:

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

Receiving strings from Foxit Quick PDF Library

Functions that return string data usually return a PWideChar, a pointer to a 16-bit null terminated Unicode strings. Some functions return a pointer to a block of 8-bit data (the functions that end with “ToString”). The memory for all string return values are 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 DLL.

To get the length of the returned Unicode string, use the DPLStringResultLength function.

To get the length of the returned 8-bit data, use the DPLAnsiStringResultLength function.

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

Product website

Please visit the Foxit Quick PDF Library website for news and information:
http://www.debenu.com/

Updated on September 7, 2017

Was this article helpful?

Related Articles