Search code examples
c#kofax

Kofax Export Connector - check for attached components


I have a webservice that publishes the scanned Kofax documents to another application.

This application webservice takes the following data:

  • the document (binary)
  • the IDs of meta fields (from the application) and their values (the index fields from Kofax)

When creating a mapping for the meta fields I would store the selected index field with the meta field ID to the releaseSetupData custom properties.

releaseSetupData.CustomProperties.Add("MetaFieldID", "IndexFieldValue");

When publishing the scanned document I want to publish a PDF file when the PDF Generator is attached otherwise a multipage TIFF file.

How can I check if this generator is attached to the batch class?

As far as I know the TIFF files from Kofax are single pages so I would have to setup a workaround by code?


Solution

  • tldr: To answer your first question: While I am not sure whether the export connector has access to the queues of the relevant, just use the PDF whenever one is available, and TIFFs otherwise.

    I'd check if if a file exists using DocumentData.KofaxPDFPath as path. If that is the case, upload a PDF. If no file exists, I'd save the images to a temporary folder using DocumentData.ImageFiles.Copy(). In both cases you may want to use File.ReadAllBytes(), depending on how your web service call handles said attachments.

    Second question: just use 0 for the ImageType as the second argument to DocumentData.ImageFiles.Copy().

    More detailed explanation:

    Unfortunately, Kofax's object model is a bit messy, here's how PDFs are handled:

    1. The property DocumentData.KofaxPDFFileName will contain a full/absolute path to the converted PDF file, if available. This usually points to a file contained in subfolders in the server file share (i.e. CaptureSV\Images)
    2. The method DocumentData.CopyKofaxPDFFile() will allow you to copy aforementioned file to the path DocumentData.KofaxPDFPath, if defined during setup.

    It's a bit of a different story for images:

    1. Images are exposed as a collection of ImageFile in DocumentData.ImageFiles. However, as you already mentioned - these are mostly single page TIFFs.
    2. DocumentData.ImageFiles.Copy() will either allow you to copy all images to the path as defined during setup, i.e. DocumentData.ImageFilePath - alternatively, you can provide a string argument with any custom path. Further, it allows you to define an ImageType, and 0 means Multipage TIFFs, CCITT Group 4 (please refer to the API Reference for further details).