SignDoc SDK (C)  5.0.0
SignDoc SDK API Documentation (C)

Overview

SignDoc SDK enables the creation of applications which handle SignDoc documents, that is, rendering as images, signing, and verifying PDF and TIFF documents.

Main Classes

The main classes of the C API of SignDoc SDK are: SIGNDOC_DocumentLoader, SIGNDOC_DocumentLoader, SIGNDOC_PdfDocumentHandler, and SIGNDOC_TiffDocumentHandler.

Usage

  1. Error handling
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <SignDocSDK-c.h>
    static const char gLicenseKey[] = "INSERT LICENSE KEY HERE";
    void check_ex (struct SIGNDOC_Exception *ex)
    {
    if (ex != NULL)
    {
    unsigned type = SIGNDOC_Exception_getType (ex);
    const char *text = SIGNDOC_Exception_getText (ex);
    if (text != NULL)
    {
    printf ("Exception: %u (%s)\n", type, text);
    }
    else
    printf ("Exception: %u\n", type);
    exit (2); /* You may want to continue in some cases */
    }
    }
    int main ()
    {
    struct SIGNDOC_Exception *ex = NULL;
  2. This is C, we must declare all variables before the first line of code.
    struct SIGNDOC_DocumentHandler *handler;
    struct SIGNDOC_DocumentLoader *loader;
    struct SIGNDOC_Document *doc;
    int page_count;
    int ok, rc;
  3. Initialize license management
    ok = SIGNDOC_DocumentLoader_setLicenseKey (&ex, gLicenseKey,
    strlen (gLicenseKey),
    NULL, NULL, NULL, 0);
    check_ex (ex);
    if (!ok)
    {
    printf ("Cannot initialize license\n");
    return 1;
    }
    Note that we use strlen() rather than sizeof() to exclude the terminating NUL character.
  4. Perform application logic (example)
    check_ex (ex);
    check_ex (ex);
    check_ex (ex);
    "test.pdf", SIGNDOC_TRUE, &doc);
    check_ex (ex);
    {
    check_ex (ex);
    printf ("Error loading document: %s\n", error);
    return 1;
    }
    page_count = SIGNDOC_Document_getPageCount (&ex, doc);
    check_ex (ex);
    printf ("Page count: %d\n", page_count);
    return 0;
    }