Example #1
0
        public static void sendDocument(string apiKey, string fileName, string formFieldLayerTemplateKey, string recipient)
        {
            FileStream file = getTestPdfFile(fileName);

            secure.echosign.com.FileInfo[] fileInfos = new secure.echosign.com.FileInfo[1];
            fileInfos[0] = new secure.echosign.com.FileInfo(fileName, null, file);
            SenderInfo senderInfo = null;

            string[] recipients = new string[1];
            recipients[0] = recipient;
            DocumentCreationInfo documentInfo = new DocumentCreationInfo(
                recipients,
                testPrefix + Path.GetFileName(file.Name),
                testMessage,
                fileInfos,
                SignatureType.ESIGN,
                SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
                );

            if (formFieldLayerTemplateKey != null)
            {
                secure.echosign.com.FileInfo[] formFieldLayerTemplates = new secure.echosign.com.FileInfo[1];
                formFieldLayerTemplates[0]           = new secure.echosign.com.FileInfo(formFieldLayerTemplateKey);
                documentInfo.formFieldLayerTemplates = formFieldLayerTemplates;
            }
            DocumentKey[] documentKeys;
            documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);
            Console.WriteLine("Document key is: " + documentKeys[0].documentKey);
        }
Example #2
0
        public static void createLibraryTemplate(string apiKey, string filename, LibraryTemplateType type)
        {
            FileStream templateFile = (filename != null) ? File.OpenRead(filename) : getTestPdfFile("testtemplate.pdf");

            filename = Path.GetFileName(templateFile.Name);

            secure.echosign.com.FileInfo[] fileInfos = new secure.echosign.com.FileInfo[1];
            fileInfos[0] = new secure.echosign.com.FileInfo(filename, null, templateFile);

            System.Nullable <LibraryTemplateType>[] libraryTemplateTypes = new System.Nullable <LibraryTemplateType> [1];
            libraryTemplateTypes[0] = LibraryTemplateType.FORM_FIELD_LAYER;
            LibraryDocumentCreationInfo libraryInfo = new LibraryDocumentCreationInfo(
                testPrefix + filename,
                fileInfos,
                SignatureType.ESIGN,
                SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED,
                LibrarySharingMode.USER,
                libraryTemplateTypes);
            LibraryDocumentCreationResult result = ES.createLibraryDocument(apiKey, null, libraryInfo);

            Console.WriteLine("Document key is: " + result.documentKey);
        }