/// <summary> /// Insert Text Signature into the Document /// </summary> /// <param name="request">Request. <see cref="PostTextFromUrlRequest" /></param> /// <returns><see cref="SignatureDocumentResponse"/></returns> public SignatureDocumentResponse PostTextFromUrl(PostTextFromUrlRequest request) { // verify the required parameter 'url' is set if (request.Url == null) { throw new ApiException(400, "Missing required parameter 'url' when calling PostTextFromUrl"); } // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/signature/text"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "url", request.Url); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "password", request.Password); 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); }
public void PostTextUrlTest() { var signOptionsData = new WordsSignTextOptionsData() { BackgroundColor = new Color() { Web = "#fcfcfc" }, BorderColor = new Color() { Web = "#364E6F" }, DocumentPageNumber = 1, Font = new SignatureFontData() { Bold = true, FontFamily = "Arial", FontSize = 12, Italic = true, Underline = false }, ForeColor = new Color() { Web = "#364E6F" }, Height = 80, HorizontalAlignment = SignTextOptionsData.HorizontalAlignmentEnum.Right, Left = 10, LocationMeasureType = SignTextOptionsData.LocationMeasureTypeEnum.Pixels, Margin = new PaddingData() { Left = 10, Right = 10, Bottom = 10, Top = 10 }, MarginMeasureType = SignTextOptionsData.MarginMeasureTypeEnum.Pixels, SignAllPages = false, Text = "1234567890", Top = 100, VerticalAlignment = SignTextOptionsData.VerticalAlignmentEnum.Center, Width = 100 }; var request = new PostTextFromUrlRequest { Url = TestFiles.WordsUrl.Url, Password = null, SignOptionsData = signOptionsData }; var response = SignatureApi.PostTextFromUrl(request); Assert.IsTrue(!string.IsNullOrEmpty(response.FileName)); }