Getting Started: DLL Edition
Installation
Included with the single DLL file DebenuPDFLibraryDLL1011.dll are various header/import files. They provide an easier way to interface with Debenu Quick PDF Library. Technical details of the interface are provided here.
Initializing/releasing 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.
InstanceID = DPLCreateLibrary();
if (DPLUnlockKey(InstanceID, "your license key") == 1) {
DPLDrawText(InstanceID, 100, 500, "Hello world");
DPLSaveToFile(InstanceID, "C:\Docs\HelloFromDLL.pdf");
}
DPLReleaseLibrary(InstanceID);
Sending strings to Debenu Quick PDF Library
Debenu 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 Debenu Quick PDF Library that may contain null characters, you can ask Debenu 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 Debenu Quick PDF Library string parameter:
char * Content = ...; // pointer to the data
Buffer = DPLCreateBuffer(10000);
DPLAddToBuffer(InstanceID, Buffer, Content, 10000);
DPLStoreCustomDataFromString(InstanceID,
"MyData", Buffer, 1, 0);
DPLReleaseBuffer(InstanceID, Buffer);
Receiving strings from Debenu 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 Debenu 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.
int ContentLength;
Content = DPLRetrieveCustomDataToString(InstanceID,
"MyData", 1);
ContentLength = DPLAnsiStringResultLength(InstanceID);
// copy the data in Content now