Hello, I'm learning Repository Access and am working on code to query the API for Eversign and download a resulting PDF into a Laserfiche Electronic File. This means that unlike examples I've seen for creating electronic files, I'll get the document from an HTTPWebResponse instead of from a file on the file system.
This code creates a PDF electronic file in Laserfiche, but the length of the PDF in Laserfiche is always zero. I'm stumped and would welcome being directed to documentation or examples that would help me crack this.
Here's the relevant section of code:
FolderInfo myFolder = Folder.GetFolderInfo("\\My Folder", session); docInfo.Create(myFolder, "Created By Document Builder", EntryNameOption.AutoRename); Stream responseStream = response.GetResponseStream(); using (MemoryStream buffer = new MemoryStream()) { // copy from http response to a MemoryStream in order to get the length prior to calling WriteEDoc() responseStream.CopyTo(buffer); using (Stream eDocStream = docInfo.WriteEdoc(response.ContentType, buffer.Length)) { docInfo.Extension = "pdf"; buffer.CopyTo(eDocStream); // The length of eDocStream is 88534 after running this statement docInfo.Save(); docInfo.Unlock(); } } // log out of the repository session.LogOut();
Thank you!