Skip to main content
Kofax

Export a generated PDF via .NET method instead of Export node

Summary

12831

It is possible in KTA to export a generated PDF without using the Export node.

To do this, we utilise the CaptureDocumentService.GetDocumentFile method. This method returns an object of type Stream. As stream isn't a supported type in KTA, this has to be called from .NET code.

Please find a sample below on how this could be achieved.

    CaptureDocumentService cds2 = new CaptureDocumentService();
    string documentId = "6A3ADB9C-00E9-4CB3-A516-A48400964E36";

    using (Stream stream = cds2.GetDocumentFile("CF804840115111D48C6100104B71BD07", null,
documentId, "pdf"))
    {
        stream.CopyTo(new FileStream(@"c:\exported\test1.pdf", FileMode.Create,
FileAccess.Write));
    }

See the following article for possible caveats:
Why might requesting a PDF from the CaptureDocumentService.GetDocumentFile API return an unexpected result?

Keywords: Stream, .Net code

  • Was this article helpful?