# fpInitWithLicenseData()

This function initializes a Filter session with license information passed in function parameters rather than a license file. Its return value, `pContext`, is passed as the first argument to the File Extraction interface and all other Filter functions.

This function is similar to fpInit(), but it uses a different licensing method. You can use either fpInit() or `fpInitWithLicenseData` to initialize your Filter session. However, these functions are mutually exclusive. That is, neither takes the context pointer from the other as an argument. If you call both functions, you initialize two distinct Filter sessions, in the same way as calling fpInit() twice.

## Syntax

    void * pascal fpInitWithLicenseData(
        KVMemoryStream  *pMemAllocator,
        KVDynLink       *pDynLink,
        char            *pszKeyViewDir,
        const char*      const pszLicenseOrganization,
        const char*      const pszLicenseKey,
        KVCharSet        outputCharSet,
        DWORD            dwFlags );

## Arguments

`pMemAllocator` | This argument is deprecated in KeyView 12.10.0 and later, and should be `NULL`. If it is not, KeyView may use the functions in this developer-defined memory allocator to allocate memory.
`pDynLink` | This argument is reserved. It must be `NULL`.
`pszKeyViewDir` | A pointer to the directory where the Filter components (such as the `formats.ini` file and file filters) are located. This is normally the `install\OS\bin` directory.
`pszLicenseOrganization` | A pointer to a string that contains the organization name under which this installation of KeyView is licensed. This value is the company name that appears at the top of the license key provided by Micro Focus. Add the text exactly as it appears in this file.
`pszLicenseKey` | A pointer to a string that contains the license key for this installation of KeyView. This value is the appropriate license key provided by Micro Focus. The key is a string that contains 31 characters, for example `2TQD22D-2M6FV66-2KPF23S-2GEM5AB`. Type these characters exactly as they appear in the license key file, including the dashes, but do not include any leading or trailing spaces.
`outputCharSet` | The character set to use for textual output when the source character set can be determined from the document or is specified by fpSetSrcCharSet(). The character sets are enumerated in `KVCharSet` in `kvcharset.h`.
`dwFlags` | Instructions on how to process a file or stream. See Flags for dwFlags for more information.

## Flags for dwFlags

`KVF_CONTENTACCESS` | Reserved for internal use.
`KVF_METADATA` | Reserved for internal use.
`KVF_OUTOFPROCESS` | Enables out-of-process filtering. This is enabled by default. See The Filter Process Model.
`KVF_INPROCESS` | Enables in-process filtering. See The Filter Process Model.
`KVF_HEADERFOOTERTAGS` | Puts tags around header and footer data.
`KVF_HEADERFOOTER` | Extracts headers and footers.
`KVF_UNICODEMSBLSB` | Uses the byte order for Big Endian systems (MSBLSB) for Unicode text. MSBLSB is the "Most Significant Byte Least Significant Byte."
`KVF_UNICODELSBMSB` | Uses the byte order for Little Endian systems (LSBMSB) for Unicode text. LSBMSB is the "Least Significant Byte Most Significant Byte."
`KVF_UNICODEMARKER` | Generates the byte order marker for Unicode text.
`KVF_NODEFAULTCHARSETCONVERT` | Prevents default conversion of document character encoding. See Customize Character Set Detection and Conversion.
`KVF_OOPLOGON` | Enables the out-of-process error log. See Enable or Disable Error Logging.
`KVF_OOPMEMTRACEON` | Enables memory trace for the out-of-process error log. See Report Memory Errors.
`KVF_OOPLOGOFF` | Disables the out-of-process error log. Enable or Disable Error Logging.
`KVF_OOPMEMTRACEOFF` | Disables memory trace for the out-of-process error log. See Report Memory Errors.
`KVF_FILTERCONTAINERCONTENT` | This flag is used by the Container API which is obsolete. It filters the main file and subfiles of a container file by using the standard filtering functions, and extracts the text to a single file.
`KVF_DETECT_OUTOFPROCESS` `KVF_DETECT_INPROCESS` | Set these flags in fpInit(), `fpInitWithLicenseData()` or fpOpenStreamEx2() to specify whether files are detected out of process or in process for a filtering session. These flags override the `default_detect_inprocess` flag in `formats.ini`. If you set neither of these flags, file detection behavior is determined by the `KVF_OUTOFPROCESS` or `KVF_INPROCESS` flags in these calls. If you do not set these flags, behavior is determined by `default_detect_inprocess` in `formats.ini`. See Run File Detection In or Out of Process.

## Returns

- If the call is successful, the return value is the pointer `pContext` which is passed as the first argument to all other File Extraction API and Filter API functions.
- If the call is unsuccessful, the return value is `NULL`.

## Discussion

- If this function returns `NULL`, check `stderr` for the KeyView installation error messages "`KeyView Filter SDK License Key has Expired"` and "`KeyView Filter SDK License Key is Invalid`", and pass them to your application.
- To make sure that multithreaded filter processes are thread-safe, you must create a unique context pointer for every thread by calling fpInit() or `fpInitWithLicenseData()`. In addition, threads must not share context pointers, and you must use the same context pointer for all API calls in the same thread. Creating a context pointer for every thread does not affect performance because the context pointer uses minimal resources.
- When the filtering context is no longer required, call fpShutdown() to terminate it.

_FT_HTML5_bannerTitle.htm