docusign-esign-csharp-client
docusign-esign-csharp-client copied to clipboard
ASP.NET 6.0 Downloading completed document is not working on newest package 6.0.0
I'm downloading file using method:
var stream = await envelopesApi.GetDocumentAsync("<api account ID>", envelopeId, envelopeDocumentId);
Then I'm saving the stream on my disk.
using var fileStream = new FileStream("signed_pdf.pdf", FileMode.Create, FileAccess.Write);
stream.CopyTo(fileStream);
Console.ReadKey();
But when I try to open this freshly saved file, I'm getting an error (tried to open it with Edge browser and Acrobat Reader - both we same result). The PDF file is probably broken.
The code on my side is correct I believe, because when I install the older version of DocuSign nuget package (5.12.0) everything is fine.
Here are two files, one saved using newest package, and second saved using 5.12.0 (take a look on the difference in size - both comes from the same envelope and same document):
I tried to spot the bug in code, but didn't have time to debug it, so I just guess that it can be somewhere here in DocuSignClient class:
As previous version was just returning MemoryStream: