Do you own a Quick PDF Library 7 or iSEDQuickPDF license? Upgrade to Quick PDF Library 8 today!

Quick PDF Library

Getting Started: DLL Edition

Installation

Included with the single DLL file QuickPDFDLL0813.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/releasing the library

All functions in the DLL use the stdcall convention. The QuickPDFCreateLibrary 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 QuickPDFReleaseLibrary to release all allocated memory.

Unlocking the library

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

  int InstanceID;
  InstanceID = QuickPDFCreateLibrary();
  if (QuickPDFUnlockKey(InstanceID, "your license key") == 1) {
    QuickPDFDrawText(InstanceID, 100, 500, "Hello world");
    QuickPDFSaveToFile(InstanceID, "C:\Docs\HelloFromDLL.pdf");
  }
  QuickPDFReleaseLibrary(InstanceID);

 

Sending strings to 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 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 QuickPDFCreateBuffer and QuickPDFAddToBuffer functions to create the buffer and fill it with data. The value returned by the QuickPDFCreateBuffer function can then be used for any Quick PDF Library string parameter:

  char * Buffer;
  char * Content = ...;  // pointer to the data
  Buffer = QuickPDFCreateBuffer(10000);
  QuickPDFAddToBuffer(InstanceID, Buffer, Content, 10000);
  QuickPDFStoreCustomDataFromString(InstanceID,
    "MyData", Buffer, 1, 0);
  QuickPDFReleaseBuffer(InstanceID, Buffer);

Receiving strings from 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 QuickPDFStringResultLength function.

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

  unsigned char * Content;
  int ContentLength;
  Content = QuickPDFRetrieveCustomDataToString(InstanceID,
    "MyData", 1);
  ContentLength = QuickPDFAnsiStringResultLength(InstanceID);
  // copy the data in Content now

© 2011 Debenu. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum