我正在遵循这些步骤。
- 我正在使用 c# API 为 DocuSign 上传 TEXT / PNG / DOCX / PPTX 文件。
- 当我在文件签名后下载该文件时,我得到了该签名文件的 PDF 格式,上传的文件格式除外。
签名完成后,是否有任何替代的代码或 API 方式如何在下载时获得相同的扩展文件。
信封 ID:- 3a6b752a-92f1-4751-b06a-ffb2c236f65d、93409bdc-edcf-4e4b-8c6f-3c76c6305dcf、5a32979b-3739-4585-a554-b725e1d65504
我在 asp.net 中使用下面的代码。
// get Lists the envelope documents.
public static EnvelopeDocumentsResult ListEnvelopeDocuments(string accountId, string envelopeId)
{
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeDocumentsResult docsList = envelopesApi.ListDocuments(accountId,
envelopeId);
return docsList;
}
// download file using envelopeId and that I get .pdf format
public static string DownloadSignedDocument(string envelopeId, string tempFileName, string companyCode, string apiUserName, string apiPassword, string integratorkey, string restApi)
{
ApiClient apiClient = new ApiClient(restApi);
Configuration.Default.ApiClient = apiClient;
// call the Login() API which sets the user's baseUrl and returns their accountId
string accountId = LoginApi(apiUserName, apiPassword, integratorkey);
// pass accountid and envelop id to get perticuler document for the download
EnvelopeDocumentsResult documentList = ListEnvelopeDocuments(accountId,
envelopeId);
string SignedPDFPath = string.Empty;
EnvelopesApi envelopesApi = new EnvelopesApi();
foreach (EnvelopeDocument document in documentList.EnvelopeDocuments)
{
MemoryStream docStream =
(MemoryStream)envelopesApi.GetDocument(accountId,
envelopeId, documentList.EnvelopeDocuments[0].DocumentId);
string documentName = document.Name != "Summary" ? document.Name :
"Summary";
SignedPDFPath =
systemConfiguration.ConfigurationManager.AppSettings["uploadFolder"] +
"/" + companyCode + "/" + "DocuSign/" + envelopeId;
if (!Directory.Exists(SignedPDFPath))
{
Directory.CreateDirectory(SignedPDFPath);
}
string[] tempFileExtention = tempFileName.Split('.');
string[] removeFileExtention = documentName.Split('.');
// need to give hardcoded ".pdf" extention because **document.Name**
//gives pdf file formate
SignedPDFPath = SignedPDFPath + "/" + removeFileExtention[0] + ".pdf"
;
// Server.MapPath("~/Uploadfiles/" + recipient.EnvelopeID + "/" +
// recipient.EnvelopeID + "_" + documentName + ".pdf");
using (FileStream fileStream = File.Create(SignedPDFPath))
{
docStream.Seek(0, SeekOrigin.Begin);
docStream.CopyTo(fileStream);
}
break;
}
return SignedPDFPath;
}