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);
}
}
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;
}