public static void SlidesDocument()
        {
            // set up Signature configuration
            SignatureConfig signConfig = Helper.GetPaths();

            // instantiating the conversion handler
            var handler = new SignatureHandler(signConfig);
            // setup digital signature options
            var signOptions = new SlidesSignDigitalOptions("test.pfx", "signature.jpg");

            signOptions.Left               = 10;
            signOptions.Top                = 10;
            signOptions.Width              = 100;
            signOptions.Height             = 100;
            signOptions.DocumentPageNumber = 1;
            signOptions.Password           = "******";
            // sign document
            var signedPath = handler.Sign <string>("test.ppt", signOptions, new SaveOptions {
                OutputType = OutputType.String
            });

            Console.WriteLine("Signed file path is: " + signedPath);
        }
        /// <summary>
        /// Saves the output/signed file with document save options
        /// </summary>
        /// <param name="fileExtension">Extension of the file</param>
        /// <param name="fileName">Name of the file</param>
        /// <param name="handler">Signature's handler</param>
        /// <param name="textSignOptions">Text sign true or false</param>
        /// <param name="imageSignOptions">Image sign true or false</param>
        /// <param name="digitalSignOptions">Digital sign true or false</param>
        public static void SaveFileWithFormat(string fileExtension, string fileName, SignatureHandler handler, object textSignOptions, object imageSignOptions, object digitalSignOptions)
        {
            //ExStart:SaveFileWithFormat
            try
            {
                switch (fileExtension)
                {
                case ".docx":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingworddocwithtextandsaveformatoption
                        WordsSignTextOptions wordTextSignOptions = (WordsSignTextOptions)textSignOptions;
                        var wordTextSignedPath = handler.Sign <string>(fileName, wordTextSignOptions, new WordsSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.WordsSaveFileFormat.Pdf
                        });
                        //ExEnd:signingworddocwithtextandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingworddocwithimageandsaveformatoption
                        WordsSignImageOptions wordImageSignOptions = (WordsSignImageOptions)imageSignOptions;
                        var wordImageSignedPath = handler.Sign <string>(fileName, wordImageSignOptions, new WordsSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.WordsSaveFileFormat.Dot
                        });
                        //ExEnd:signingworddocwithimageandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingworddocwithdigitalcertificatesandsaveformatoption
                        WordsSignDigitalOptions wordDigitalSignOptions = (WordsSignDigitalOptions)digitalSignOptions;
                        var wordDigitalSignedPath = handler.Sign <string>(fileName, wordDigitalSignOptions, new WordsSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.WordsSaveFileFormat.Dotm
                        });
                        //ExEnd:signingworddocwithdigitalcertificatesandsaveformatoption
                    }

                    break;

                case ".pdf":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingpdfdocwithtextandsaveformatoption
                        PdfSignTextOptions pdfTextSignOptions = (PdfSignTextOptions)textSignOptions;
                        var pdfTextSignedPath = handler.Sign <string>(fileName, pdfTextSignOptions, new PdfSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.PdfSaveFileFormat.Doc
                        });
                        //ExEnd:signingpdfdocwithtextandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingpdfdocwithimageandsaveformatoption
                        PdfSignImageOptions pdfImageSignOptions = (PdfSignImageOptions)imageSignOptions;
                        var pdfImageSignedPath = handler.Sign <string>(fileName, pdfImageSignOptions, new PdfSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.PdfSaveFileFormat.Doc
                        });
                        //ExEnd:signingpdfdocwithimageandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingpdfdocwithdigitalcertificatesandsaveformatoption
                        PdfSignDigitalOptions pdfDigitalSignOptions = (PdfSignDigitalOptions)digitalSignOptions;
                        var pdfDigitalSignedPath = handler.Sign <string>(fileName, pdfDigitalSignOptions, new PdfSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.PdfSaveFileFormat.Pdf
                        });
                        //ExEnd:signingpdfdocwithdigitalcertificatesandsaveformatoption
                    }

                    break;

                case ".xlsx":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingexceldocwithtextandsaveformatoption
                        CellsSignTextOptions cellTextSignOptions = (CellsSignTextOptions)textSignOptions;
                        var cellTextSignedPath = handler.Sign <string>(fileName, cellTextSignOptions, new CellsSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.CellsSaveFileFormat.Xlsm
                        });
                        //ExEnd:signingexceldocwithtextandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingexceldocwithimageandsaveformatoption
                        CellsSignImageOptions cellImageSignOptions = (CellsSignImageOptions)imageSignOptions;
                        var cellImageSignedPath = handler.Sign <string>(fileName, cellImageSignOptions, new CellsSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.CellsSaveFileFormat.Xlsm
                        });
                        //ExEnd:signingexceldocwithimageandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingexceldocwithdigitalcertificatesandsaveformatoption
                        CellsSignDigitalOptions cellDigitalSignOptions = (CellsSignDigitalOptions)digitalSignOptions;
                        var cellDigitalSignedPath = handler.Sign <string>(fileName, cellDigitalSignOptions, new CellsSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.CellsSaveFileFormat.Xlsm
                        });
                        //ExEnd:signingexceldocwithdigitalcertificatesandsaveformatoption
                    }

                    break;

                case ".pptx":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingslidesdocwithtextandsaveformatoption
                        SlidesSignTextOptions slildeTextSignOptions = (SlidesSignTextOptions)textSignOptions;
                        var slideTextSignedPath = handler.Sign <string>(fileName, slildeTextSignOptions, new SlidesSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.SlidesSaveFileFormat.Odp
                        });
                        //ExEnd:signingslidesdocwithtextandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingslidesdocwithimageandsaveformatoption
                        SlidesSignImageOptions slideImageSignOptions = (SlidesSignImageOptions)imageSignOptions;
                        var slideImageSignedPath = handler.Sign <string>(fileName, slideImageSignOptions, new SlidesSaveOptions {
                            OutputType = OutputType.String, FileFormat = Domain.SlidesSaveFileFormat.Odp
                        });
                        //ExEnd:signingslidesdocwithimageandsaveformatoption
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingslidesdocwithdigitalcertificatesandsaveformatoption
                        SlidesSignDigitalOptions slideDigitalSignOptions = (SlidesSignDigitalOptions)digitalSignOptions;
                        var slideDigitalSignedPath = handler.Sign <string>(fileName, slideDigitalSignOptions, new SlidesSaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingslidesdocwithdigitalcertificatesandsaveformatoption
                    }

                    break;
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            //ExEnd:SaveFileWithFormat
        }
        /// <summary>
        /// Saves the output/signed file
        /// </summary>
        /// <param name="fileExtension">Extension of the file</param>
        /// <param name="fileName">Name of the file</param>
        /// <param name="handler">Signature's handler</param>
        /// <param name="textSignOptions">Text sign true or false</param>
        /// <param name="imageSignOptions">Image sign true or false</param>
        /// <param name="digitalSignOptions">Digital sign true or false</param>
        public static void SaveFile(string fileExtension, string fileName, SignatureHandler handler, object textSignOptions, object imageSignOptions, object digitalSignOptions)
        {
            //ExStart:saveoutputfile
            try
            {
                switch (fileExtension)
                {
                case ".docx":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingworddocwithtext
                        WordsSignTextOptions wordTextSignOptions = (WordsSignTextOptions)textSignOptions;
                        var wordTextSignedPath = handler.Sign <string>(fileName, wordTextSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingworddocwithtext
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingworddocwithimage
                        WordsSignImageOptions wordImageSignOptions = (WordsSignImageOptions)imageSignOptions;
                        var wordImageSignedPath = handler.Sign <string>(fileName, wordImageSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingworddocwithimage
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingworddocwithdigitalcertificates
                        WordsSignDigitalOptions wordDigitalSignOptions = (WordsSignDigitalOptions)digitalSignOptions;
                        var wordDigitalSignedPath = handler.Sign <string>(fileName, wordDigitalSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingworddocwithdigitalcertificates
                    }

                    break;

                case ".pdf":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingpdfdocwithtext
                        PdfSignTextOptions pdfTextSignOptions = (PdfSignTextOptions)textSignOptions;
                        var pdfTextSignedPath = handler.Sign <string>(fileName, pdfTextSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingpdfdocwithtext
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingpdfdocwithimage
                        PdfSignImageOptions pdfImageSignOptions = (PdfSignImageOptions)imageSignOptions;
                        var pdfImageSignedPath = handler.Sign <string>(fileName, pdfImageSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingpdfdocwithimage
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingpdfdocwithdigitalcertificates
                        PdfSignDigitalOptions pdfDigitalSignOptions = (PdfSignDigitalOptions)digitalSignOptions;
                        var pdfDigitalSignedPath = handler.Sign <string>(fileName, pdfDigitalSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingpdfdocwithdigitalcertificates
                    }

                    break;

                case ".xlsx":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingexceldocwithtext
                        CellsSignTextOptions cellTextSignOptions = (CellsSignTextOptions)textSignOptions;
                        var cellTextSignedPath = handler.Sign <string>(fileName, cellTextSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingexceldocwithtext
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingexceldocwithimage
                        CellsSignImageOptions cellImageSignOptions = (CellsSignImageOptions)imageSignOptions;
                        var cellImageSignedPath = handler.Sign <string>(fileName, cellImageSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingexceldocwithimage
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingexceldocwithdigitalcertificates
                        CellsSignDigitalOptions cellDigitalSignOptions = (CellsSignDigitalOptions)digitalSignOptions;
                        var cellDigitalSignedPath = handler.Sign <string>(fileName, cellDigitalSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingexceldocwithdigitalcertificates
                    }

                    break;

                case ".pptx":
                    if (textSignOptions != null)
                    {
                        //ExStart:signingslidesdocwithtext
                        SlidesSignTextOptions slildeTextSignOptions = (SlidesSignTextOptions)textSignOptions;
                        var slideTextSignedPath = handler.Sign <string>(fileName, slildeTextSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingslidesdocwithtext
                    }
                    else if (textSignOptions == null && imageSignOptions != null)
                    {
                        //ExStart:signingslidesdocwithimage
                        SlidesSignImageOptions slideImageSignOptions = (SlidesSignImageOptions)imageSignOptions;
                        var slideImageSignedPath = handler.Sign <string>(fileName, slideImageSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingslidesdocwithimage
                    }
                    else if (textSignOptions == null && imageSignOptions == null && digitalSignOptions != null)
                    {
                        //ExStart:signingslidesdocwithdigitalcertificates
                        SlidesSignDigitalOptions slideDigitalSignOptions = (SlidesSignDigitalOptions)digitalSignOptions;
                        var slideDigitalSignedPath = handler.Sign <string>(fileName, slideDigitalSignOptions, new SaveOptions {
                            OutputType = OutputType.String
                        });
                        //ExEnd:signingslidesdocwithdigitalcertificates
                    }

                    break;
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            //ExEnd:saveoutputfile
        }