Esempio n. 1
0
        static QrCodeSignOptions GetQrCodeSignOptions()
        {
            QrCodeSignOptions result = new QrCodeSignOptions("123456789012", QrCodeTypes.Aztec);

            // alignment settings
            result.Left       = 100;
            result.Top        = 50;
            result.Width      = 200;
            result.Height     = 120;
            result.AllPages   = true;
            result.PageNumber = 1;
            result.PagesSetup = new PagesSetup()
            {
                FirstPage = true, LastPage = false, OddPages = true, EvenPages = false, PageNumbers = { 1, 2, 3 }
            };
            result.HorizontalAlignment = Domain.HorizontalAlignment.Right;
            result.VerticalAlignment   = Domain.VerticalAlignment.Center;
            // border settings
            result.Border.Color        = System.Drawing.Color.Red;
            result.Border.DashStyle    = GroupDocs.Signature.Domain.DashStyle.DashLongDash;
            result.Border.Transparency = 0.8;
            result.Border.Weight       = 2;
            result.Border.Visible      = true;
            // background settings
            result.Background.Color        = System.Drawing.Color.Yellow;
            result.Background.Transparency = 0.5;
            result.ForeColor = System.Drawing.Color.Green;

            return(result);
        }
        /// <summary>
        /// Sign document and make it password-protected
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SaveDocumentWithPassword : Sign document and make it password-protected\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SaveSignedWithPassword", fileName);

            using (Signature signature = new Signature(filePath))
            {
                // create QRCode option with predefined QRCode text
                QrCodeSignOptions signOptions = new QrCodeSignOptions("JohnSmith")
                {
                    // setup QRCode encoding type
                    EncodeType = QrCodeTypes.QR,

                    // set signature position
                    Left = 100,
                    Top  = 100
                };

                SaveOptions saveOptions = new SaveOptions()
                {
                    Password            = "******",
                    UseOriginalPassword = false
                };
                // sign document to file
                SignResult result = signature.Sign(outputFilePath, signOptions, saveOptions);
                Console.WriteLine($"\nSource document signed successfully with {result.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
            }
        }
        /// <summary>
        /// Sign image and save it to different output type
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SaveSignedImageWithDifferentOutputFileType : Sign image and save it to different output type\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_IMAGE;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SaveSignedOutputType", "Sample_PngToJpg.jpg");

            using (Signature signature = new Signature(filePath))
            {
                // create QRCode option with predefined QRCode text
                QrCodeSignOptions signOptions = new QrCodeSignOptions("JohnSmith")
                {
                    // setup QRCode encoding type
                    EncodeType = QrCodeTypes.QR,
                    // set signature position
                    Left = 100,
                    Top  = 100
                };

                ImageSaveOptions saveOptions = new ImageSaveOptions()
                {
                    FileFormat             = ImageSaveFileFormat.Jpg,
                    OverwriteExistingFiles = true
                };
                // sign document to file
                SignResult result = signature.Sign(outputFilePath, signOptions, saveOptions);
                Console.WriteLine($"\nSource document signed successfully with {result.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
            }
        }
        private QrCodeSignOptions GetLocationOptions(string signLocation)
        {
            QrCodeSignOptions options = new QrCodeSignOptions();

            switch (signLocation)
            {
            case "top right":
                options.VerticalAlignment   = VerticalAlignment.Top;
                options.HorizontalAlignment = HorizontalAlignment.Right;
                break;

            case "top left":
                options.VerticalAlignment   = VerticalAlignment.Top;
                options.HorizontalAlignment = HorizontalAlignment.Left;
                break;

            case "bottom right":
                options.VerticalAlignment   = VerticalAlignment.Bottom;
                options.HorizontalAlignment = HorizontalAlignment.Right;
                break;

            case "bottom left":
                options.VerticalAlignment   = VerticalAlignment.Bottom;
                options.HorizontalAlignment = HorizontalAlignment.Left;
                break;
            }

            return(options);
        }
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # LoadDocumentFromFtp : Load document from ftp\n");

            string filePath       = "ftp://localhost/sample.doc";
            string outputFilePath = Path.Combine(Constants.OutputPath, "SignFromStream", "signedSample.doc");

            using (Stream stream = GetFileFromFtp(filePath))
            {
                using (Signature signature = new Signature(stream))
                {
                    QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                    {
                        EncodeType = QrCodeTypes.QR,
                        Left       = 100,
                        Top        = 100
                    };

                    // sign document to file
                    signature.Sign(outputFilePath, options);
                }
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
        /// <summary>
        /// Sign document with qr-code signature
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Basic Usage] # SignWithQRCode : Sign document with QR-Code\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCode", fileName);

            using (Signature signature = new Signature(filePath))
            {
                // create QRCode option with predefined QRCode text
                QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                {
                    // setup QRCode encoding type
                    EncodeType = QrCodeTypes.QR,

                    // set signature position
                    Left   = 50,
                    Top    = 150,
                    Width  = 200,
                    Height = 200
                };

                // sign document to file
                SignResult result = signature.Sign(outputFilePath, options);

                Console.WriteLine($"\nSource document signed successfully with {result.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Sign password-protected document
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # LoadPasswordProtectedDocument : Sign password-protected document\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF_SIGNED_PWD;
            string fileName = Path.GetFileName(filePath);

            string      outputFilePath = Path.Combine(Constants.OutputPath, "LoadPasswordProtected", fileName);
            LoadOptions loadOptions    = new LoadOptions()
            {
                Password = "******"
            };

            using (Signature signature = new Signature(filePath, loadOptions))
            {
                QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                {
                    EncodeType = QrCodeTypes.QR,
                    Left       = 100,
                    Top        = 100
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
Esempio n. 8
0
        /// <summary>
        /// Add word signature data
        /// </summary>
        /// <returns>SignOptions</returns>
        public override SignOptions SignWord()
        {
            // setup options
            QrCodeSignOptions signOptions = new QrCodeSignOptions(qrCodeData.text);

            SetOptions(signOptions);
            return(signOptions);
        }
        private BarcodeSignOptions GetBarcodeSignOptions(string signText, string signLocation, string signSize)
        {
            var options = new BarcodeSignOptions(signText)
            {
                EncodeType          = BarcodeTypes.Code128,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = new Padding(10),

                Border = new Border()
                {
                    Color        = Color.LightGray,
                    DashStyle    = DashStyle.Solid,
                    Transparency = 0.5,
                    Visible      = true,
                    Weight       = 2
                },

                ForeColor = Color.Black,
                Font      = new SignatureFont {
                    Size = 12, FamilyName = "Comic Sans MS"
                },
                CodeTextAlignment = CodeTextAlignment.Below,

                Background = new Background()
                {
                    Color        = Color.LightSteelBlue,
                    Transparency = 0.2,
                    Brush        = new LinearGradientBrush(Color.White, Color.LightSteelBlue)
                }
            };

            QrCodeSignOptions locationOptions = GetLocationOptions(signLocation);

            options.HorizontalAlignment = locationOptions.HorizontalAlignment;
            options.VerticalAlignment   = locationOptions.VerticalAlignment;


            switch (signSize)
            {
            case "small":
                options.Width  = 100;
                options.Height = 50;
                break;

            case "medium":
                options.Width  = 100 * 2;
                options.Height = 50 * 2;
                break;

            case "large":
                options.Width  = 100 * 3;
                options.Height = 50 * 3;
                break;
            }

            return(options);
        }
        /// <summary>
        /// Sign document with QR-Code containing standard VCard object
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithQRCodeVCard : Sign document with QR-Code containing standard VCard object\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeVCard", "QRCodeVCardObject.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // create VCard object
                VCard vCard = new VCard()
                {
                    FirstName   = "Sherlock",
                    MidddleName = "Jay",
                    LastName    = "Holmes",
                    Initials    = "Mr.",
                    Company     = "Watson Inc.",
                    JobTitle    = "Detective",
                    HomePhone   = "0333 003 3577",
                    WorkPhone   = "0333 003 3512",
                    Email       = "*****@*****.**",
                    Url         = "http://sherlockholmes.com/",
                    BirthDay    = new DateTime(1854, 1, 6),
                    HomeAddress = new Address()
                    {
                        Street  = "221B Baker Street",
                        City    = "London",
                        State   = "NW",
                        ZIP     = "NW16XE",
                        Country = "England"
                    }
                };
                // create options
                QrCodeSignOptions options = new QrCodeSignOptions
                {
                    EncodeType = QrCodeTypes.QR,
                    // setup Data property to VCard instance
                    Data = vCard,
                    // set right bottom corner
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width  = 100,
                    Height = 100,
                    Margin = new Padding(10)
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }

            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
Esempio n. 11
0
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Quick Start] # Options serialization and deserialization\n");

            List <SignOptions> collection = new List <SignOptions>();

            TextSignOptions textSignOptions = GetTextSignOptions();

            collection.Add(textSignOptions);

            ImageSignOptions imageSignOptions = GetImageSignOptions();

            collection.Add(imageSignOptions);

            DigitalSignOptions digitalSignOptions = GetDigitalSignOptions();

            collection.Add(digitalSignOptions);

            BarcodeSignOptions barcodeSignOptions = GetBarcodeSignOptions();

            collection.Add(barcodeSignOptions);

            QrCodeSignOptions qrCodeSignOptions = GetQrCodeSignOptions();

            collection.Add(qrCodeSignOptions);

            string serialized = JsonConvert.SerializeObject(collection);

            JsonConverter[] converters = { new SignOptionsJsonConverter(), new BarcodeTypeJsonConverter(), new QrCodeTypeJsonConverter() };

            List <SignOptions> deserialized = JsonConvert.DeserializeObject <List <SignOptions> >(serialized, converters);

            Console.WriteLine(deserialized.Count);

            if (deserialized != null)
            {
                // The path to the documents directory.
                string filePath = Constants.SAMPLE_PDF;
                string fileName = System.IO.Path.GetFileName(filePath);

                string outputFilePath = Path.Combine(Constants.OutputPath, "OptionsSerialization", fileName);

                using (Signature signature = new Signature(filePath))
                {
                    // sign document to file
                    SignResult signResult = signature.Sign(outputFilePath, deserialized);

                    Console.WriteLine($"\nSource document signed successfully with {signResult.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
                }
            }
        }
Esempio n. 12
0
 private static void SetOptions(QrCodeSignOptions signOptions)
 {
     signOptions.EncodeType          = QrCodeTypes.QR;
     signOptions.HorizontalAlignment = SignatureData.getHorizontalAlignment();
     signOptions.VerticalAlignment   = SignatureData.getVerticalAlignment();
     signOptions.Width      = Convert.ToInt32(SignatureData.ImageWidth);
     signOptions.Height     = Convert.ToInt32(SignatureData.ImageHeight);
     signOptions.Top        = Convert.ToInt32(SignatureData.Top);
     signOptions.Left       = Convert.ToInt32(SignatureData.Left);
     signOptions.PageNumber = SignatureData.PageNumber;
     if (SignatureData.Angle != 0)
     {
         signOptions.RotationAngle = SignatureData.Angle;
     }
 }
        private ImageSignOptions GetImageSignOptions(string signImagePath, string signLocation, string signSize)
        {
            var options = new ImageSignOptions(signImagePath)
            {
                Width               = 100,
                Height              = 100,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,

                Margin = new Padding(10)
            };

            TextShadow shadow = new TextShadow()
            {
                Color        = Color.DarkGray,
                Angle        = 65,
                Blur         = 3,
                Distance     = 4,
                Transparency = 0.3
            };

            options.Extensions.Add(shadow);

            QrCodeSignOptions locationOptions = GetLocationOptions(signLocation);

            options.HorizontalAlignment = locationOptions.HorizontalAlignment;
            options.VerticalAlignment   = locationOptions.VerticalAlignment;

            switch (signSize)
            {
            case "small":
                options.Width  = 50;
                options.Height = 50;
                break;

            case "medium":
                options.Width  = 50 * 2;
                options.Height = 50 * 2;
                break;

            case "large":
                options.Width  = 50 * 3;
                options.Height = 50 * 3;
                break;
            }

            return(options);
        }
        /// <summary>
        /// Sign document with QR-Code signature applying specific options
        /// </summary>
        public static void Run()
        {
            // The path to the documents directory.
            string filePath       = Constants.SAMPLE_PDF;
            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeSecureCustom", "QRCodeEncryptedObject.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // setup key and passphrase
                string key  = "1234567890";
                string salt = "1234567890";
                // create data encryption
                IDataEncryption encryption = new SymmetricEncryption(SymmetricAlgorithmType.Rijndael, key, salt);

                // create custom object
                DocumentSignatureData documentSignatureData = new DocumentSignatureData()
                {
                    ID         = Guid.NewGuid().ToString(),
                    Author     = Environment.UserName,
                    Signed     = DateTime.Now,
                    DataFactor = 11.22M
                };

                // setup QR-Code options
                QrCodeSignOptions options = new QrCodeSignOptions()
                {
                    // set custom object to serialize to QR Code
                    Data = documentSignatureData,
                    // QR-code type
                    EncodeType = QrCodeTypes.QR,
                    // specify serialization encryption
                    DataEncryption = encryption,
                    // locate and align signature
                    Height              = 100,
                    Width               = 100,
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin              = new Padding()
                    {
                        Right = 10, Bottom = 10
                    }
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
        /// <summary>
        /// Sign document and handle incorrect password exception
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # HandlingIncorrectPasswordException : Sign document and handle incorrect password exception\n");

            // The path to the documents directory
            // This file is secured with password
            string filePath       = Constants.SAMPLE_PDF_SIGNED_PWD;
            string fileName       = Path.GetFileName(filePath);
            string outputFilePath = Path.Combine(Constants.OutputPath, "HandlingExceptions", fileName);
            // initialize LoadOptions with incorrect Password
            LoadOptions loadOptions = new LoadOptions()
            {
                Password = "******"
            };

            using (Signature signature = new Signature(filePath, loadOptions))
            {
                try
                {
                    QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                    {
                        EncodeType = QrCodeTypes.QR,
                        Left       = 100,
                        Top        = 100
                    };
                    // try to sign document to file, we expect for PasswordRequiredException
                    signature.Sign(outputFilePath, options);
                    Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
                }
                catch (IncorrectPasswordException ex)
                {
                    Console.WriteLine($"HandlingIncorrectPasswordException: {ex.Message}");
                }
                catch (GroupDocsSignatureException ex)
                {
                    Console.WriteLine($"Common GroupDocsSignatureException: {ex.Message}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Common Exception happens only at user code level: {ex.Message}");
                }
                finally
                {
                }
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Sign document with QR-Code containing standard EPC/SEPA object.
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithQRCodeEPCObject : Sign document with QR-Code containing standard QR-Code EPC object\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeEPC", "QRCodeEPCObject.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // create EPC object
                EPC epc = new EPC()
                {
                    Name        = "Sherlock",
                    BIC         = "MrSherlockH",
                    IBAN        = "BE72000000001616",
                    Amount      = 123456.78D,
                    Code        = "SHRL",
                    Reference   = "Private service",
                    Information = "Thanks for help"
                };
                // create options
                QrCodeSignOptions options = new QrCodeSignOptions
                {
                    EncodeType = QrCodeTypes.QR,
                    // setup Data property to EPC instance
                    Data = epc,
                    // set right bottom corner
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width  = 100,
                    Height = 100,
                    Margin = new Padding(10)
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }

            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
Esempio n. 17
0
        /// <summary>
        /// Sign document and result analysis
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithResultAnalysis : Sign document and result analysis\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCode", fileName);

            using (Signature signature = new Signature(filePath))
            {
                // create QRCode option with predefined QRCode text
                QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                {
                    // setup QRCode encoding type
                    EncodeType = QrCodeTypes.QR,
                    // set location as right down corner
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Bottom
                };

                // sign document to file
                SignResult signResult = signature.Sign(outputFilePath, options);
                if (signResult.Failed.Count == 0)
                {
                    Console.WriteLine("\nAll signatures were successfully created!");
                }
                else
                {
                    Console.WriteLine($"Successfully created signatures : {signResult.Succeeded.Count}");
                    Helper.WriteError($"Failed signatures : {signResult.Failed.Count}");
                }
                Console.WriteLine("\nList of newly created signatures:");
                int number = 1;
                foreach (BaseSignature temp in signResult.Succeeded)
                {
                    Console.WriteLine($"Signature #{number++}: Type: {temp.SignatureType} Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");
                }
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
        /// <summary>
        /// Sign document with QR-Code containing standard Address object
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithQRCodeAddress : Sign document with QR-Code containing standard Address object\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeAddress", "QRCodeAddressObject.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // create Address object
                Address address = new Address()
                {
                    Street  = "221B Baker Street",
                    City    = "London",
                    State   = "NW",
                    ZIP     = "NW16XE",
                    Country = "England"
                };

                // create options
                QrCodeSignOptions options = new QrCodeSignOptions
                {
                    EncodeType = QrCodeTypes.QR,
                    // setup Data property to Address instance
                    Data = address,
                    // set right bottom corner
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Margin = new Padding(10),
                    Width  = 100,
                    Height = 100,
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }

            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
        private ImageSignOptions GetDigitalSignOptions(string signText, string signImagePath, string signLocation, string signSize)
        {
            string pfxPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6) + "\\sample_certificate.pfx";

            var options = new DigitalSignOptions(pfxPath, signImagePath)
            {
                Contact  = signText,
                Reason   = "reason",
                Location = "location",
                Password = "******",

                Width               = 100,
                Height              = 100,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin              = new Padding(10),
            };

            QrCodeSignOptions locationOptions = GetLocationOptions(signLocation);

            options.HorizontalAlignment = locationOptions.HorizontalAlignment;
            options.VerticalAlignment   = locationOptions.VerticalAlignment;

            switch (signSize)
            {
            case "small":
                options.Width  = 50;
                options.Height = 50;
                break;

            case "medium":
                options.Width  = 50 * 2;
                options.Height = 50 * 2;
                break;

            case "large":
                options.Width  = 50 * 3;
                options.Height = 50 * 3;
                break;
            }

            return(options);
        }
        /// <summary>
        /// Sign document with QR-Code containing standard Event object.
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithQRCodeEventObject : Sign document with QR-Code containing standard QR-Code Event object\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeEvent", "QRCodeEventObject.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // create Event object
                Event evnt = new Event()
                {
                    Title       = "GTM(9-00)",
                    Description = "General Team Meeting",
                    Location    = "Conference-Room",
                    StartDate   = DateTime.Now.Date.AddDays(1).AddHours(9),
                    EndDate     = DateTime.Now.Date.AddDays(1).AddHours(9).AddMinutes(30)
                };
                // create options
                QrCodeSignOptions options = new QrCodeSignOptions
                {
                    EncodeType = QrCodeTypes.QR,
                    // setup Data property to Event instance
                    Data = evnt,
                    // set right bottom corner
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width  = 100,
                    Height = 100,
                    Margin = new Padding(10)
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }

            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
Esempio n. 21
0
        /// <summary>
        /// Sign document and save it as image
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SaveSignedDocumentsAsImages : Sign document and save it as image\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignSaveToImage", "SignedAndSavedAsImage.png");

            using (Signature signature = new Signature(filePath))
            {
                QrCodeSignOptions signOptions = new QrCodeSignOptions("JohnSmith")
                {
                    EncodeType = QrCodeTypes.QR,
                    Left       = 100,
                    Top        = 100
                };

                //Export to image options
                ExportImageSaveOptions exportImageSaveOptions = new ExportImageSaveOptions(ImageSaveFileFormat.Png)
                {
                    //set pages border style
                    Border = new Border()
                    {
                        Color = Color.Brown, Weight = 5, DashStyle = DashStyle.Solid, Transparency = 0.5
                    },
                    // specify pages to export
                    PagesSetup = new PagesSetup()
                    {
                        FirstPage = true, LastPage = true
                    },
                    // specify output image view - all pages could be located on one column or each by each on several columns
                    PageColumns = 2
                };

                // sign document to file
                SignResult result = signature.Sign(outputFilePath, signOptions, exportImageSaveOptions);
                Console.WriteLine($"\nSource document signed successfully with {result.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Sign document with QR-Code containing standard Email object
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithQRCodeEmail : Sign document with QR-Code containing standard Email object\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeEmail", "QRCodeEmailObject.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // create Email object
                Email email = new Email()
                {
                    Address = "*****@*****.**",
                    Subject = "Very important e-mail",
                    Body    = "Hello, Watson. Reach me ASAP!"
                };

                // create options
                QrCodeSignOptions options = new QrCodeSignOptions
                {
                    EncodeType = QrCodeTypes.QR,
                    // setup Data property to Email instance
                    Data = email,
                    // set right bottom corner
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width  = 100,
                    Height = 100,
                    Margin = new Padding(10)
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }

            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
        public static void Run()
        {
            string blobName       = "sample.docx";
            string outputFilePath = Path.Combine(Constants.OutputPath, "SignFromStream", "signedSample.docx");

            using (Stream stream = DownloadFile(blobName))
            {
                using (Signature signature = new Signature(stream))
                {
                    QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                    {
                        EncodeType = QrCodeTypes.QR,
                        Left       = 100,
                        Top        = 100
                    };
                    // sign document to file
                    signature.Sign(outputFilePath, options);
                }
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
Esempio n. 24
0
            protected override SignOptions Create(Type objectType, JObject jObject)
            {
                SignOptions result        = null;
                var         signatureType = GetSignatureType(jObject);

                // check SignatureType
                // check for Barcode options
                if (signatureType == SignatureType.Barcode)
                {
                    result = new BarcodeSignOptions();
                }
                // check for QrCode options
                if (result == null && signatureType == SignatureType.QrCode)
                {
                    result = new QrCodeSignOptions();
                }
                // check for digital options
                if (result == null && signatureType == SignatureType.Digital)
                {
                    result = new DigitalSignOptions();
                }
                // check for text options
                if (result == null && signatureType == SignatureType.Text)
                {
                    result = new TextSignOptions();
                }
                // check for image options
                if (result == null && signatureType == SignatureType.Image)
                {
                    result = new ImageSignOptions();
                }
                // check for stamp options
                if (result == null && signatureType == SignatureType.Stamp)
                {
                    result = new StampSignOptions();
                }

                return(result);
            }
        /// <summary>
        /// Sign document with QR-Code signature applying specific options
        /// </summary>
        public static void Run()
        {
            // The path to the documents directory.
            string filePath       = Constants.SAMPLE_PDF;
            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithQRCodeSecureCustom", "QRCodeEncryptedText.pdf");

            using (Signature signature = new Signature(filePath))
            {
                // setup key and passphrase
                string key  = "1234567890";
                string salt = "1234567890";
                // create data encryption
                IDataEncryption encryption = new SymmetricEncryption(SymmetricAlgorithmType.Rijndael, key, salt);

                // setup QR-Code options
                QrCodeSignOptions options = new QrCodeSignOptions()
                {
                    //setup text to be secured
                    Text       = "This is private text to be secured.",
                    EncodeType = QrCodeTypes.QR,
                    // specify text encryption
                    DataEncryption = encryption,
                    // locate and align signature
                    Height              = 100,
                    Width               = 100,
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin              = new Padding()
                    {
                        Right = 10, Bottom = 10
                    }
                };

                // sign document to file
                signature.Sign(outputFilePath, options);
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
Esempio n. 26
0
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # LoadDocumentFromStream : Sign document from stream\n");

            string outputFilePath = Path.Combine(Constants.OutputPath, "LoadDocumentFromStream", "signedSample.xlsx");

            using (Stream stream = File.OpenRead(Constants.SAMPLE_SPREADSHEET))
            {
                using (Signature signature = new Signature(stream))
                {
                    QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
                    {
                        EncodeType = QrCodeTypes.QR,
                        Left       = 100,
                        Top        = 100
                    };

                    // sign document to file
                    signature.Sign(outputFilePath, options);
                }
            }
            Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
        }
        /// <summary>
        /// Sign document with multiple signature types
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Basic Usage] # SignWithMultipleOptions : Sign document with multiple signature types \n");

            // The path to the documents directory.
            string filePath       = Constants.SAMPLE_WORDPROCESSING;
            string outputFilePath = Path.Combine(Constants.OutputPath, "SignWithMultiple", "SignWithMultiple.docx");

            using (Signature signature = new Signature(filePath))
            {
                // define several signature options of different types and settings
                TextSignOptions textOptions = new TextSignOptions("Text signature")
                {
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left
                };
                BarcodeSignOptions barcodeOptions = new BarcodeSignOptions("123456")
                {
                    EncodeType = BarcodeTypes.Code128,
                    Left       = 0,
                    Top        = 150,
                    Height     = 50,
                    Width      = 200
                };
                QrCodeSignOptions qrcodeOptions = new QrCodeSignOptions("JohnSmith")
                {
                    EncodeType = QrCodeTypes.QR,
                    Left       = 0,
                    Top        = 220
                };
                DigitalSignOptions digitalOptions = new DigitalSignOptions(Constants.CertificatePfx)
                {
                    ImageFilePath = Constants.ImageHandwrite,
                    Left          = 20,
                    Top           = 400,
                    Height        = 100,
                    Width         = 100,
                    Password      = "******"
                };
                ImageSignOptions imageOptions = new ImageSignOptions(Constants.ImageStamp)
                {
                    Left   = 20,
                    Top    = 550,
                    Height = 100,
                    Width  = 100
                };
                MetadataSignOptions metaOptions = new MetadataSignOptions();
                WordProcessingMetadataSignature[] metaSignatures = new WordProcessingMetadataSignature[]
                {
                    new WordProcessingMetadataSignature("Author", "Mr.Scherlock Holmes"),
                    new WordProcessingMetadataSignature("CreatedOn", DateTime.Now)
                };
                metaOptions.Signatures.AddRange(metaSignatures);

                // define list of signature options
                List <SignOptions> listOptions = new List <SignOptions>();

                listOptions.Add(textOptions);
                listOptions.Add(barcodeOptions);
                listOptions.Add(qrcodeOptions);
                listOptions.Add(digitalOptions);
                listOptions.Add(imageOptions);
                listOptions.Add(metaOptions);

                // sign document to file
                SignResult result = signature.Sign(outputFilePath, listOptions);

                Console.WriteLine($"\nSource document signed successfully with {result.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
            }
        }
        /// <summary>
        /// Sign document with QR-Code signature applying specific options
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SignWithQRCodeAdvanced : Sign document with QR-Code signature applying specific options\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_PDF;
            string fileName = Path.GetFileName(filePath);

            string outputPath     = Path.Combine(Constants.OutputPath, "SignWithQRCodeAdvanced");
            string outputFilePath = System.IO.Path.Combine(outputPath, fileName);

            using (Signature signature = new Signature(filePath))
            {
                // create QRCode option with predefined QRCode text
                QrCodeSignOptions options = new QrCodeSignOptions("12345678")
                {
                    // setup QRCode encoding type
                    EncodeType = QrCodeTypes.QR,

                    // set signature position
                    Left = 100,
                    Top  = 100,

                    // set signature alignment

                    // when VerticalAlignment is set the Top coordinate will be ignored.
                    // Use Margin properties Top, Bottom to provide vertical offset
                    VerticalAlignment = VerticalAlignment.Top,

                    // when HorizontalAlignment is set the Left coordinate will be ignored.
                    // Use Margin properties Left, Right to provide horizontal offset
                    HorizontalAlignment = HorizontalAlignment.Right,

                    Margin = new Padding()
                    {
                        Top = 20, Right = 20
                    },

                    // adjust signature appearance

                    // setup signature border
                    Border = new Border()
                    {
                        Visible   = true,
                        Color     = Color.OrangeRed,
                        DashStyle = DashStyle.DashLongDashDot,
                        Weight    = 2
                    },

                    // set text color and Font
                    ForeColor = Color.Red,
                    Font      = new SignatureFont {
                        Size = 12, FamilyName = "Comic Sans MS"
                    },

                    // setup background
                    Background = new Background()
                    {
                        Color        = Color.LimeGreen,
                        Transparency = 0.5,
                        Brush        = new LinearGradientBrush(Color.LimeGreen, Color.DarkGreen)
                    },
                    // set field for QRCode images returning
                    ReturnContent = true,
                    // specify type of returned QRCode images
                    ReturnContentType = FileType.PNG
                };

                // sign document to file
                SignResult signResult = signature.Sign(outputFilePath, options);
                Console.WriteLine($"\nSource document signed successfully with {signResult.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");

                Console.WriteLine("\nList of newly created signatures:");
                int number = 1;
                foreach (QrCodeSignature qrCodeSignature in signResult.Succeeded)
                {
                    Console.WriteLine($"Signature #{number++}: Type: {qrCodeSignature.SignatureType} Id:{qrCodeSignature.SignatureId}, Location: {qrCodeSignature.Left}x{qrCodeSignature.Top}. Size: {qrCodeSignature.Width}x{qrCodeSignature.Height}");
                    Console.WriteLine($"Location at {qrCodeSignature.Left}-{qrCodeSignature.Top}. Size is {qrCodeSignature.Width}x{qrCodeSignature.Height}.");

                    string outputImagePath = System.IO.Path.Combine(outputPath, $"image{number}{qrCodeSignature.Format.Extension}");

                    using (FileStream fs = new FileStream(outputImagePath, FileMode.Create))
                    {
                        fs.Write(qrCodeSignature.Content, 0, qrCodeSignature.Content.Length);
                    }
                    number++;
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Sign image document with qr-code signature and save it to various image output types
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # SaveSignedImageWithVariousOutputTypes : Sign image document with qr-code signature and save it to various image output types\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_IMAGE;
            string fileName = Path.GetFileName(filePath);

            using (Signature signature = new Signature(filePath))
            {
                QrCodeSignOptions signOptions = new QrCodeSignOptions("JohnSmith")
                {
                    EncodeType = QrCodeTypes.QR, Left = 100, Top = 100
                };

                SaveOptions[] listSaveOptions = new SaveOptions[]
                {
                    // create Bmp save options with advanced settings
                    new BmpSaveOptions()
                    {
                        Compression          = BitmapCompression.Rgb,
                        HorizontalResolution = 7,
                        VerticalResolution   = 7,
                        BitsPerPixel         = 16,
                    },
                    // create Gif save options with advanced settings
                    new GifSaveOptions()
                    {
                        BackgroundColorIndex = 2,
                        ColorResolution      = 7,
                        DoPaletteCorrection  = true,
                        HasTrailer           = true,
                        Interlaced           = false,
                        IsPaletteSorted      = true,
                        PixelAspectRatio     = 24
                    },
                    // create Jpeg save options with advanced settings
                    new JpegSaveOptions()
                    {
                        AddMissingExtenstion = true,
                        BitsPerChannel       = 8,
                        ColorType            = JpegCompressionColorMode.Rgb,
                        Comment = "signed jpeg file",
                        //CompressionType = JpegCompressionMode.Lossless,
                        Quality            = 100,
                        SampleRoundingMode = JpegRoundingMode.Extrapolate
                    },
                    // create png save options with advanced settings
                    new PngSaveOptions()
                    {
                        BitDepth         = 8,
                        ColorType        = PngColorType.Grayscale,
                        CompressionLevel = 9,
                        FilterType       = PngFilterType.Adaptive,
                        Progressive      = true
                    },
                    new TiffSaveOptions()
                    {
                        ExpectedTiffFormat = TiffFormat.TiffNoCompressionBw
                    }
                };
                foreach (SaveOptions saveOptions in listSaveOptions)
                {
                    // set flag to overwrite existing files
                    saveOptions.OverwriteExistingFiles = true;
                    // set flag to add missing extension automatically
                    saveOptions.AddMissingExtenstion = true;
                    var outputFilePath = Path.Combine(Constants.OutputPath, "SaveSignedImageOutputType", "sample_PngTo" + saveOptions.GetType().Name.ToString());
                    // sign document to file
                    SignResult result = signature.Sign(outputFilePath, signOptions, saveOptions);
                    Console.WriteLine($"\nSource document signed successfully with {result.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
                }
            }
        }
        /// <summary>
        /// Following example shows how to process QR-Code Signature over all signature life-cycle.
        /// First document is being signed with QR-Code Signature, then verified for it, searched for same, updating and finally deleting this signature.
        /// Please be aware that this example works only on licensed product due to limitation with QR-code processing
        /// </summary>
        public static void Run()
        {
            Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("[Example Advanced Usage] # ProcessingQrCodeSignatureOverCRUD : Process QR-Code Signature over all signature life-cycle\n");

            // The path to the documents directory.
            string filePath = Constants.SAMPLE_WORDPROCESSING;
            string fileName = Path.GetFileName(filePath);

            string        outputFilePath = Path.Combine(Constants.OutputPath, "ProcessingQRCodeSignatureOverCRUD", fileName);
            List <string> signatureIds   = new List <string>();
            // -----------------------------------------------------------------------------------------------------------------------------
            // STEP 1. Sign document with QR-Code Signature
            // -----------------------------------------------------------------------------------------------------------------------------
            string bcText = "John Smith";

            using (Signature signature = new Signature(filePath))
            {
                QrCodeSignOptions signOptions = new QrCodeSignOptions(bcText, QrCodeTypes.QR)
                {
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Width  = 100,
                    Height = 40,
                    Margin = new Padding(20),
                    // set QR-Code color and Font
                    ForeColor = Color.Red,
                    Font      = new SignatureFont {
                        Size = 12, FamilyName = "Comic Sans MS"
                    }
                };
                // sign document to file
                SignResult signResult = signature.Sign(outputFilePath, signOptions);
                Console.WriteLine("\nDocument {filePath} was signed with following signatures:");
                foreach (BaseSignature temp in signResult.Succeeded)
                {
                    // collect newly created signature' Id
                    signatureIds.Add(temp.SignatureId);
                    Console.WriteLine($"Signature : {temp.SignatureType} Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");
                }
            }
            // -----------------------------------------------------------------------------------------------------------------------------
            // STEP 2. Verify document for QrCode Signature
            // -----------------------------------------------------------------------------------------------------------------------------
            using (Signature signature = new Signature(outputFilePath))
            {
                QrCodeVerifyOptions verifyOptions = new QrCodeVerifyOptions()
                {
                    // specify if all pages should be verified
                    AllPages   = false,
                    PageNumber = 1,
                    // QrCode type
                    EncodeType = QrCodeTypes.QR,
                    //
                    Text = bcText
                };
                // verify document signatures
                VerificationResult verifyResult = signature.Verify(verifyOptions);
                if (verifyResult.IsValid)
                {
                    Console.WriteLine("\nDocument was verified successfully!");
                }
                else
                {
                    Helper.WriteError("\nDocument failed verification process.");
                }
                // -----------------------------------------------------------------------------------------------------------------------------
                // STEP 3. Search document for QrCode Signature
                // -----------------------------------------------------------------------------------------------------------------------------
                QrCodeSearchOptions searchOptions = new QrCodeSearchOptions()
                {
                    // specify special pages to search on
                    AllPages = true
                };
                // search for QrCode signatures in document
                List <QrCodeSignature> signatures = signature.Search <QrCodeSignature>(searchOptions);
                Console.WriteLine("\nSource document contains following QrCode signature(s).");
                // enumerate all signature for output
                foreach (QrCodeSignature qrSignature in signatures)
                {
                    if (qrSignature != null)
                    {
                        Console.WriteLine($"Found QrCode signature at page {qrSignature.PageNumber} with type [{qrSignature.EncodeType.TypeName}] and QrCode Text '{qrSignature.Text}'.");
                        Console.WriteLine($"Location at {qrSignature.Left}-{qrSignature.Top}. Size is {qrSignature.Width}x{qrSignature.Height}.");
                    }
                }
                // -----------------------------------------------------------------------------------------------------------------------------
                // STEP 4. Update document QrCode Signature after searching it
                // -----------------------------------------------------------------------------------------------------------------------------
                foreach (QrCodeSignature qrSignature in signatures)
                {
                    // change position
                    qrSignature.Left = qrSignature.Left + 100;
                    qrSignature.Top  = qrSignature.Top + 100;
                    // change size. Please note not all documents support changing signature size
                    qrSignature.Width  = 200;
                    qrSignature.Height = 50;
                }
                List <BaseSignature> signaturesToUpdate = signatures.ConvertAll(p => (BaseSignature)p);
                UpdateResult         updateResult;
                updateResult = signature.Update(signaturesToUpdate);
                if (updateResult.Succeeded.Count == signatures.Count)
                {
                    Console.WriteLine("\nAll signatures were successfully updated!");
                }
                else
                {
                    Console.WriteLine($"Successfully updated signatures : {updateResult.Succeeded.Count}");
                    Helper.WriteError($"Not updated signatures : {updateResult.Failed.Count}");
                }
                Console.WriteLine("List of updated signatures:");
                foreach (BaseSignature temp in updateResult.Succeeded)
                {
                    Console.WriteLine($"Signature# Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");
                }
                // -----------------------------------------------------------------------------------------------------------------------------
                // STEP 5. Update document QrCode Signature on saved SignatureId
                // create list of QrCode Signature by known SignatureId
                // -----------------------------------------------------------------------------------------------------------------------------
                signaturesToUpdate.Clear();
                foreach (var item in signatureIds)
                {
                    QrCodeSignature temp = new QrCodeSignature(item)
                    {
                        Width  = 150,
                        Height = 30,
                        Left   = 100,
                        Top    = 100
                    };
                    signaturesToUpdate.Add(temp);
                }
                // update all found signatures
                updateResult = signature.Update(signaturesToUpdate);
                if (updateResult.Succeeded.Count == signatures.Count)
                {
                    Console.WriteLine("\nAll signatures were successfully updated!");
                }
                else
                {
                    Console.WriteLine($"Successfully updated signatures : {updateResult.Succeeded.Count}");
                    Helper.WriteError($"Not updated signatures : {updateResult.Failed.Count}");
                }
                Console.WriteLine("List of updated signatures:");
                foreach (BaseSignature temp in updateResult.Succeeded)
                {
                    Console.WriteLine($"Signature# Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");
                }
                // -----------------------------------------------------------------------------------------------------------------------------
                // STEP 6. Delete document QrCode Signature by id
                // create list of QrCode Signature by known SignatureId
                signaturesToUpdate.Clear();
                foreach (var item in signatureIds)
                {
                    QrCodeSignature temp = new QrCodeSignature(item);
                    signaturesToUpdate.Add(temp);
                }
                // delete all signatures
                DeleteResult deleteResult = signature.Delete(signaturesToUpdate);
                if (deleteResult.Succeeded.Count == signaturesToUpdate.Count)
                {
                    Console.WriteLine("\nAll signatures were successfully deleted!");
                }
                else
                {
                    Console.WriteLine($"Successfully deleted signatures : {deleteResult.Succeeded.Count}");
                    Helper.WriteError($"Not deleted signatures : {deleteResult.Failed.Count}");
                }
                Console.WriteLine("List of deleted signatures:");
                foreach (BaseSignature temp in deleteResult.Succeeded)
                {
                    Console.WriteLine($"Signature# Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");
                }
            }
        }