Skip to main content

Kofax TotalAgility 7.x - How to get a generated PDF as a File Stream using code?


  1. To get the PDF as a file stream, we would use the captureDocumentService.getDocumentFile api.
  2. This example saves the generated PDF to the location specified:
    CaptureDocumentService cds = new CaptureDocumentService();
    string documentId = "6e430dad-c4b4-4ab7-abc5-a58600b01cb8";
    FileStream FS = new FileStream(@"c:\exported\test.pdf", FileMode.Create, FileAccess.Write);
    using (Stream stream = cds.GetDocumentFile(SessionId, null, documentId, "pdf"))
    You could then try to rotate the PDF or another action.
  3. Then we can ingest again this new file version.

Keywords: Generated, pdf, stream, code