document content is null?
Wednesday, February 24, 2021 at 06:57amTrying to save signed docs on our server. Looping through the doc collection, Content is null with code bellow:
//retrieve signed package from one span
var pkg = oss.GetPackage(req.PackageId);
foreach (var doc in pkg.Documents)
{
//assume docName was set up according to a good pattern
var path = "documents/" + doc.Name + ".pdf";
File.WriteAllBytes(path, doc.Content);
}
Code below works, but seems like a waste to call OneSpan for each doc in the package.
foreach (var doc in pkg.Documents)
{
//assume docName was set up according to a good pattern
var path = "documents/" + doc.Name + ".pdf";
byte[] pdfDocumentBytes = oss.Client.DownloadDocument(pkg.Id, doc.Id);
File.WriteAllBytes(path, pdfDocumentBytes);
}
Why does doc object have a Content prop if it is empty?
Reply to: document content is null?
Wednesday, February 24, 2021 at 08:40amHi Chris,
You need to invoke extra calls to download document content, that's because the file binary is not coming together with the .GetPackage() response. To further reduce the number of outbound API calls, you can download all the signed documents in a zip file, and extract it in memory before saving to local separately.
byte[] zipContent = eslClient.DownloadZippedDocuments(packageId);
Duo
Reply to: Hi Chris, You need to…
Wednesday, February 24, 2021 at 03:47pmThanks, Duo.