/// <summary>
        /// Insert QRCode Signature into the Document
        /// </summary>
        /// <param name="request">Request. <see cref="PostQRCodeRequest" /></param>
        /// <returns><see cref="SignatureDocumentResponse"/></returns>
        public SignatureDocumentResponse PostQRCode(PostQRCodeRequest request)
        {
            // verify the required parameter 'name' is set
            if (request.Name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling PostQRCode");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/signature/{name}/qrcode";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "name", request.Name);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "password", request.Password);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.Folder);
            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);
        }
Example #2
0
        public void PostQRCodeTest()
        {
            var file            = TestFiles.Pdf02;
            var signOptionsData = new PdfSignQRCodeOptionsData()
            {
                QRCodeTypeName  = "QR",
                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 = SignQRCodeOptionsData.HorizontalAlignmentEnum.Right,
                Left = 10,
                LocationMeasureType = SignQRCodeOptionsData.LocationMeasureTypeEnum.Pixels,
                Margin = new PaddingData()
                {
                    Left = 10, Right = 10, Bottom = 10, Top = 10
                },
                MarginMeasureType = SignQRCodeOptionsData.MarginMeasureTypeEnum.Pixels,
                Opacity           = 0.5,
                SignAllPages      = false,
                Text = "1234567890",
                Top  = 100,
                VerticalAlignment = SignQRCodeOptionsData.VerticalAlignmentEnum.Center,
                Width             = 100
            };
            var request = new PostQRCodeRequest
            {
                Name            = TestFiles.Pdf02.FileName,
                SignOptionsData = signOptionsData,
                Password        = null,
                Folder          = TestFiles.Pdf02.Folder
            };

            var response = SignatureApi.PostQRCode(request);

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