0

Whenever I am trying to get the image file using the document Id, getting following error

Could not load file or assembly 'Kofax.CEBPM.ThinClient.DocumentServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cf95ca7471e897ff' or one of its dependencies. The system cannot find the file specified.

FYI : Document ID is valid and I am able to search the image in KTA's Repository Browser.

I have tried different ways to get the image but all are failing. Any help ?

private static void GetDocument(string sessionId, string docId)
{
    try
    {
        CaptureDocumentService captureDocumentService = new CaptureDocumentService();

        ReportingData reportingData = new ReportingData();

        // Using simple GetDocument method
        Document document = captureDocumentService.GetDocument(sessionId, null, docId);

        // Using GetDocumentAsFile with valid path
        captureDocumentService.GetDocumentAsFile(sessionId, docId, @"C:\ValidPath\", "dummy.abc");
    }
    catch (Exception ex)
    {
        Console.WriteLine();
        Console.WriteLine(ex.Message);
    }
}

Properties Image

ktaSharp
  • 27
  • 7

1 Answers1

0

Judging from the error message, their either is an issue with permissions (check your path and ACLs in KTA) or the kind of file in your repository (are you sure it's a TIFF?)

Personally, I'd go with the GetDocumentFile method - this returns a stream, which may give you more flexibility. Here's an example:

    public string ExportDocumentImages(string sessionId, string documentId, string outputFolder, string extension)
    {
        var cds = new CaptureDocumentService();
        var doc = cds.GetDocument(sessionId, null, documentId);
    
        Directory.CreateDirectory(outputFolder);
        var fileName = Path.Combine(
            outputFolder,
            doc.Id + extension);
    
        using (var fs = File.Create(fileName))
        {
            var s = cds.GetDocumentFile(sessionId, null, doc.Id, "");
            s.CopyTo(fs);
        }
        return fileName;
    }

Wolfgang Radl
  • 2,319
  • 2
  • 17
  • 22
  • Yes is it TIFF file. I am trying to fetch the document from a server and saving locally in my PC. – ktaSharp Dec 16 '20 at 21:13
  • Somehow Kofax.CEBPM.ThinClient.DocumentServices libraries were not being copied at run time. After fixing the Dlls issue, I am now getting following - **Error. The following configuration setting could not be found: CoreServicesLocation** – ktaSharp Dec 16 '20 at 23:27
  • Recommend getting in touch with Kofax Tech Support. They will help you resolve this issue. – Wolfgang Radl Dec 17 '20 at 16:59
  • Moved a bit closer, now I am getting following error **[Agility.Server.Core.Model.Interfaces.Services.ICaptureDocumentService], cannot be used for communication because it is in the Faulted state** Anyone know where can I enable or check this service ? – ktaSharp Dec 17 '20 at 18:12
  • I could not find why I am not able to get Document from my console app. Give up! I achieved what I required by creating User Interface *Form*. This can be closed. – ktaSharp Jan 04 '21 at 17:16