KeyView 24.1

# Export a File to PDF

The following example illustrates how to initialize KeyView by using `fpInit()`, use the `fpConvertFileToFile()` file method, and then shutdown using `fpShutdown()`.

This example uses the `KVPDFGetInterface` function pointer, `fpGetInterface()`. For details of how to load the `kvpdf` library and obtain this pointer, see Get a Session Context.

In this example:

- `pszKeyViewDir` is the path of the folder containing the KeyView binaries, for example `C:\MicroFocus\KeyviewExportSDK-12.3.0\WINDOWS_X86_64\bin`.
- `pszTempFolder` is the path to a folder which can be used to store temporary files.
- `pszInFileName` is the name of the input file.
- `pszOutFileName` is the name of the PDF file to create. If the output file already exists it is overwritten if possible. The output PDF cannot be in the working directory.

All strings must be null-terminated.

For more details about the functions used, see C API Reference.

    #include "kvpdf.h"

    BOOL exportFileToPDF(
        KVPDFInterface sInterface,
        const char* const pszKeyViewDir,
        const char* const pszTempFolder,
        const char* const pszLicense,
        const char* const pszInFileName,
        const char* const pszOutFileName)
    {
        KVPDFContext context = NULL;
        KVPDFOptions sOptions = {0};
        BOOL bSuccess = FALSE;

        KVStructInit(&sOptions);

        if (sInterface.fpInit(
                pszKeyViewDir, pszTempFolder, pszLicense, &context
            ).eErrorCode == KVERR_Success)
        {
            bSuccess = sInterface.fpConvertFileToFile(
                context, pszInFileName, pszOutFileName, sOptions
            ).eErrorCode == KVERR_Success;

            sInterface.fpShutDown(&context);
        }

        return bSuccess;
    }

Copyright 1997-2023 Open Text
Version 24.1 | Last updated December 2023

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: IDOL KeyView 24.1

Topic Title: Export a File to PDF