/// <summary>
        /// Insert Image Signature into the Document provided by URL
        /// </summary>
        /// <param name="request">Request. <see cref="PostImageFromUrlRequest" /></param>
        /// <returns><see cref="SignatureDocumentResponse"/></returns>
        public SignatureDocumentResponse PostImageFromUrl(PostImageFromUrlRequest request)
        {
            // verify the required parameter 'url' is set
            if (request.Url == null)
            {
                throw new ApiException(400, "Missing required parameter 'url' when calling PostImageFromUrl");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/signature/image";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "url", request.Url);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "password", request.Password);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "image", request.Image);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage);
            var postBody = SerializationHelper.Serialize(request.SignOptionsData); // http body (model) parameter
            var response = this.apiInvoker.InvokeApi(
                resourcePath,
                "POST",
                postBody,
                null,
                null);

            if (response != null)
            {
                return((SignatureDocumentResponse)SerializationHelper.Deserialize(response, typeof(SignatureDocumentResponse)));
            }

            return(null);
        }
Beispiel #2
0
        public void PostImageUrlTest()
        {
            var signOptionsData = new WordsSignImageOptionsData()
            {
                DocumentPageNumber  = 1,
                Height              = 80,
                HorizontalAlignment = SignImageOptionsData.HorizontalAlignmentEnum.Right,
                Left = 10,
                LocationMeasureType = SignImageOptionsData.LocationMeasureTypeEnum.Pixels,
                Margin = new PaddingData()
                {
                    Left = 10, Right = 10, Bottom = 10, Top = 10
                },
                MarginMeasureType = SignImageOptionsData.MarginMeasureTypeEnum.Pixels,
                Opacity           = 0.5,
                SignAllPages      = false,
                ImageGuid         = "storage/01_pages.png",
                Top = 100,
                VerticalAlignment = SignImageOptionsData.VerticalAlignmentEnum.Center,
                Width             = 100
            };
            var request = new PostImageFromUrlRequest
            {
                Url             = TestFiles.WordsUrl.Url,
                Password        = null,
                SignOptionsData = signOptionsData
            };

            var response = SignatureApi.PostImageFromUrl(request);

            Assert.IsTrue(!string.IsNullOrEmpty(response.FileName));
        }