From c17bb7c6a5fa05e92515fd29e835f0d9a1f8e6c5 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 27 Mar 2024 15:05:50 +0200 Subject: [PATCH] Added name and email of signer to the document in Document Visibility --- launcher-csharp/doc_1.html | 1 + .../Examples/SetDocumentVisibility.cs | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/launcher-csharp/doc_1.html b/launcher-csharp/doc_1.html index be6ec517..f11b1d6b 100644 --- a/launcher-csharp/doc_1.html +++ b/launcher-csharp/doc_1.html @@ -11,6 +11,7 @@ color: darkblue;">Order Processing Division

Ordered by {USER_FULLNAME}

Email: {USER_EMAIL}

+

Copy to: {CC_NAME}, {CC_EMAIL}

Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie. Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée. Gummi bears cupcake biscuit tiramisu sugar plum pastry. Dragée gummies applicake pudding liquorice. Donut jujubes oat cake jelly-o. Dessert bear claw chocolate cake gummies lollipop sugar plum ice cream gummies cheesecake.

diff --git a/launcher-csharp/eSignature/Examples/SetDocumentVisibility.cs b/launcher-csharp/eSignature/Examples/SetDocumentVisibility.cs index 085509fd..2cd451e2 100644 --- a/launcher-csharp/eSignature/Examples/SetDocumentVisibility.cs +++ b/launcher-csharp/eSignature/Examples/SetDocumentVisibility.cs @@ -81,7 +81,14 @@ private static EnvelopeDefinition PrepareEnvelope( EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition { EmailSubject = "Please sign this document set", - Documents = PrepareDocumentsForTemplate(docPdf, docDocx, docHtml), + Documents = PrepareDocumentsForTemplate( + signer1Email, + signer1Name, + ccEmail, + ccName, + docPdf, + docDocx, + docHtml), EnforceSignerVisibility = "true", }; @@ -159,11 +166,24 @@ private static Signer PrepareSigner( }; } - private static List PrepareDocumentsForTemplate(string docPdf, string docDocx, string docHtml) + private static List PrepareDocumentsForTemplate( + string signer1Email, + string signer1Name, + string ccEmail, + string ccName, + string docPdf, + string docDocx, + string docHtml) { byte[] pdfFileContentInBytes = System.IO.File.ReadAllBytes(docPdf); byte[] docxFileContentInBytes = System.IO.File.ReadAllBytes(docDocx); - byte[] htlmFileContentInBytes = System.IO.File.ReadAllBytes(docHtml); + + string htmlFileContentsString = System.IO.File.ReadAllText(docHtml); + htmlFileContentsString = htmlFileContentsString.Replace("{USER_EMAIL}", signer1Email); + htmlFileContentsString = htmlFileContentsString.Replace("{USER_FULLNAME}", signer1Name); + htmlFileContentsString = htmlFileContentsString.Replace("{CC_EMAIL}", ccEmail); + htmlFileContentsString = htmlFileContentsString.Replace("{CC_NAME}", ccName); + byte[] htlmFileContentInBytes = System.Text.Encoding.UTF8.GetBytes(htmlFileContentsString); return new List {