File Content Extraction 26.1
PDF Export SDK C Programming Guide

# Obtain File Format Information

File Content Extraction allows you to obtain the following basic information for a file:

- The character set. See the `KVCharSet` enumerated type.
- The class of document. See the `ENdocClass` enumerated type.
- The specific type of document. See the `ENdocFmt` enumerated type.
- Some other attributes such as the presence of encryption. See the `ENdocAttributes` enumerated type.

You can obtain the file format information by using the `fpGetFileInfo()` function pointer.

You call `fpGetFileInfo()` with the path to the file, and a pointer to a `KVDocInfo` structure that File Content Extraction can fill with the file details. For more details about the `fpGetFileInfo()` function pointer, see C API Reference.

## Get the Types of Files in a List

The following example illustrates how to:

- obtain function pointers by calling `KVPDFGetInterface`. The pointer to this method is passed into the function as `fpGetInterface` in this example. You need this pointer to get other function pointers, including `fpInit()`, which must be called first, and `fpShutdown()`, which must be called last. For details of how to obtain this pointer, see Get a Session Context.
- initialize File Content Extraction using `fpInit`.
- use the `fpGetFileInfo()` method for each path in an array of file names (`ppszFileNames` in this example). The file types output are put in the `peFileTypesOutput` array of enumerated type `ENdocFmt`.
- shut down File Content Extraction by calling `fpShutdown()`.

NOTE: If a call to `fpGetFileInfo` is unsuccessful, the `KVDocInfo` structure is not modified. The return value of `fpGetFileInfo` is therefore ignored in this example because the `KVDocInfo` structure is left zero-filled with the character set equal to `KVCS_UNKNOWN`, the document class to set to `AutoDetNoFormat`, and the file type of `Unknown_Fmt`.

    #include "kvpdf.h"

    void getTypesOfFilesInList(
        const KVPDFInterface sInterface,
        const char* const pszKeyViewDir,
        const char* const pszTempFolder,
        const char* const pszLicense,
        const char* const * const ppszFileNames,
        ENdocFmt* const peFileTypesOutput,
        const unsigned int numberOfFiles)
    {
        KVPDFContext context = NULL;
        unsigned int i = 0;

        if(sInterface.fpInit(
                pszKeyViewDir, pszTempFolder, pszLicense, &context
            ).eErrorCode != KVERR_Success)
        {
            return;
        }

        for (i = 0; i < numberOfFiles; i++)
        {
            // (ENdocFmt) 0 = Unknown_Fmt
            KVDocInfo sDocInfo = {0};
            sInterface.fpGetFileInfo(context, ppszFileNames[i], &sDocInfo);
            peFileTypesOutput[i] = sDocInfo.adInfo.eFormat;
        }

        sInterface.fpShutDown(&context);
    }

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: Obtain File Format Information