private DocuSignAPI.Document[] GetDocuments() { List <DocuSignAPI.Document> runningList = new List <DocuSignAPI.Document>(); if (Request.Form["stockdoc"] != null) { // Use the document that came with this sample DocuSignAPI.Document stockDocument = new DocuSignAPI.Document(); stockDocument.PDFBytes = Resources.DocuSign_Demo__111_PDF; stockDocument.Name = "Demo Document"; stockDocument.ID = "1"; stockDocument.FileExtension = "pdf"; Debug.Assert(stockDocument.PDFBytes != null); runningList.Add(stockDocument); } else { // Upload and use any file uploads HttpFileCollection uploadedFiles = Request.Files; for (int i = 0; i < uploadedFiles.Count; i++) { HttpPostedFile file = uploadedFiles[i]; if (file.ContentLength > 0) { DocuSignAPI.Document uploadedDocument = new DocuSignAPI.Document(); System.IO.Stream inStream = file.InputStream; byte[] fileData = new byte[file.ContentLength]; inStream.Read(fileData, 0, file.ContentLength); uploadedDocument.PDFBytes = fileData; uploadedDocument.Name = file.FileName; uploadedDocument.ID = (i + 1).ToString(); uploadedDocument.FileExtension = Path.GetExtension(file.FileName).ToLower(); Debug.Assert(uploadedDocument.PDFBytes != null); runningList.Add(uploadedDocument); } } } if (Request.Form["signerattachment"] != null) { // Add a document for signer attachments DocuSignAPI.Document signerAttachment = new DocuSignAPI.Document(); signerAttachment.PDFBytes = Resources.BlankPDF; signerAttachment.Name = "Signer Attachment"; signerAttachment.ID = "2"; signerAttachment.FileExtension = "pdf"; signerAttachment.AttachmentDescription = "Please attach your document here"; Debug.Assert(signerAttachment.PDFBytes != null); runningList.Add(signerAttachment); } return(runningList.ToArray()); }
protected void CreateAndSend() { DocuSignAPI.EnvelopeStatus status = null; buttonTable.Visible = false; // Construct the envelope basics DocuSignAPI.Envelope envelope = new DocuSignAPI.Envelope(); envelope.Subject = "DocuSign API SDK Example"; envelope.EmailBlurb = "This envelope demonstrates embedded signing"; envelope.AccountId = Session["APIAccountId"].ToString(); // Create the recipient(s) envelope.Recipients = ConstructRecipients(); // Add the document to the envelope DocuSignAPI.Document stockDocument = new DocuSignAPI.Document(); stockDocument.PDFBytes = Resources.DocuSign_Demo__111_PDF; stockDocument.Name = "Demo Document"; stockDocument.ID = "1"; stockDocument.FileExtension = "pdf"; envelope.Documents = new DocuSignAPI.Document[] { stockDocument }; // Add the tabs to the envelope envelope.Tabs = AddTabs(envelope.Recipients.Length); DocuSignAPI.APIServiceSoapClient client = CreateAPIProxy(); try { // Send the envelope and temporarily store the status in the session status = client.CreateAndSendEnvelope(envelope); if (status.SentSpecified) { Session["EnvelopeStatus"] = status; base.AddEnvelopeID(status.EnvelopeID); // Start the first signer SignFirst(status); } } catch (Exception ex) { base.GoToErrorPage(ex.Message); } }
private DocuSignAPI.Document[] GetDocuments() { List<DocuSignAPI.Document> runningList = new List<DocuSignAPI.Document>(); if (Request.Form["stockdoc"] != null) { // Use the document that came with this sample DocuSignAPI.Document stockDocument = new DocuSignAPI.Document(); stockDocument.PDFBytes = Resources.DocuSign_Demo__111_PDF; stockDocument.Name = "Demo Document"; stockDocument.ID = "1"; stockDocument.FileExtension = "pdf"; Debug.Assert(stockDocument.PDFBytes != null); runningList.Add(stockDocument); } else { // Upload and use any file uploads HttpFileCollection uploadedFiles = Request.Files; for (int i = 0; i < uploadedFiles.Count; i++) { HttpPostedFile file = uploadedFiles[i]; if (file.ContentLength > 0) { DocuSignAPI.Document uploadedDocument = new DocuSignAPI.Document(); System.IO.Stream inStream = file.InputStream; byte[] fileData = new byte[file.ContentLength]; inStream.Read(fileData, 0, file.ContentLength); uploadedDocument.PDFBytes = fileData; uploadedDocument.Name = file.FileName; uploadedDocument.ID = (i + 1).ToString(); uploadedDocument.FileExtension = Path.GetExtension(file.FileName).ToLower(); Debug.Assert(uploadedDocument.PDFBytes != null); runningList.Add(uploadedDocument); } } } if (Request.Form["signerattachment"] != null) { // Add a document for signer attachments DocuSignAPI.Document signerAttachment = new DocuSignAPI.Document(); signerAttachment.PDFBytes = Resources.BlankPDF; signerAttachment.Name = "Signer Attachment"; signerAttachment.ID = "2"; signerAttachment.FileExtension = "pdf"; signerAttachment.AttachmentDescription = "Please attach your document here"; Debug.Assert(signerAttachment.PDFBytes != null); runningList.Add(signerAttachment); } return runningList.ToArray(); }