File Content Extraction 26.1
PDF Export SDK C Programming Guide

# Get a Session Context

Use of the PDF Export API requires the following steps:

1. Dynamically load the `kvpdf` shared library.
2. Obtain a handle to the `KVPDFGetInterface` function.
3. Call the `KVPDFGetInterface` function to obtain function pointers for the library methods.
4. Call the `fpInit()` function pointer to initialize File Content Extraction.
5. Perform any necessary tasks using the Export API.
6. Call `fpShutdown()` to close down File Content Extraction.
7. Free the `kvpdf` library.

The code you use to load the library at the start and free the library at the end depends on your operating system. See Use the kvpdf library on Windows and Use the kvpdf library on Linux

After you have obtained the function pointer for the `KVPDFGetInterface` function, you can use it to get pointers to the other functions. These include `fpInit()`, which you must use to initialize File Content Extraction before any other call, and `fpShutdown()` which must be the last call you make, to shutdown File Content Extraction and free its resources. See Export a File to PDF and Obtain File Format Information.

The following examples describe how to load the `kvpdf` library and obtain the `KVPDFGetInterface` function pointer (`fpGetInterface()` in the example code).

## Use the kvpdf library on Windows

In the following example, `pszPathOfkvpdfdll` is the path to the `kvpdf` dynamic library, for example `C:\MicroFocus\KeyviewExportSDK-12.3.0\WINDOWS_X86_64\bin\kvpdf.dll`.

    #include "kvpdf.h"
    #include <windows.h>
    #include <stdio.h>

    void usePDFExport(const char* const pszPathOfkvpdfdll)
    {
        HMODULE hMODULE = LoadLibraryA(pszPathOfkvpdfdll);
        if (hMODULE)
        {
            KVPDF_GET_INTERFACE fpGetInterface =
                (KVPDF_GET_INTERFACE) GetProcAddress(
                    hMODULE, "KVPDFGetInterface"
                );
            if (fpGetInterface)
            {
                KVPDFInterface sInterface = {0};
                KVStructInit(&sInterface);
                if(fpGetInterface(&sInterface))
                {
                    // Code using PDF Export
                }
            }
            FreeLibrary(hMODULE);
        }
    }

## Use the kvpdf library on Linux

In the following example, `pszPathOfkvpdfso` is the path to the `kvpdf` dynamic library, for example `/opt/MicroFocus/KeyviewExportSDK-12.3.0/LINUX_X86_64_LIBC6/bin/kvpdf.so`.

    #include "kvpdf.h"
    #include <dlfcn.h>

    void usePDFExport(const char* const pszPathOfkvpdfso)
    {
        void *libHandle = dlopen(pszPathOfkvpdfso, RTLD_LAZY);
        if (libHandle)
        {
            KVPDF_GET_INTERFACE fpGetInterface =
                dlsym(libHandle, "KVPDFGetInterface");
            if (fpGetInterface)
            {
                KVPDFInterface sInterface = {0};
                KVStructInit(&sInterface);
                if(fpGetInterface(&sInterface))
                {
                    // Code using PDF Export
                }
            }
            dlclose(libHandle);
        }
    }

Copyright 1997-2025 Open Text
Version 26.1 | Last updated January 2026

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: File Content Extraction 26.1

Topic Title: Get a Session Context