Пример #1
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new DocumentApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/sample-10-pages.docx"
                };

                var options = new SplitOptions
                {
                    FileInfo   = fileInfo,
                    OutputPath = "Output/split-to-multipage-document",
                    Pages      = new List <int?> {
                        3, 6, 8
                    },
                    Mode = SplitOptions.ModeEnum.Intervals
                };

                var request  = new SplitRequest(options);
                var response = apiInstance.Split(request);

                foreach (var document in response.Documents)
                {
                    Console.WriteLine("Output file path: " + document.Path);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
Пример #2
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new DocumentApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/sample-10-pages.docx"
                };

                var options = new SplitOptions
                {
                    FileInfo        = fileInfo,
                    OutputPath      = "Output/split-by-start-end-numbers",
                    StartPageNumber = 3,
                    EndPageNumber   = 7,
                    Mode            = SplitOptions.ModeEnum.Pages
                };

                var request  = new SplitRequest(options);
                var response = apiInstance.Split(request);

                foreach (var document in response.Documents)
                {
                    Console.WriteLine("Output file path: " + document.Path);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new PagesApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "Pdf/ten-pages.pdf"
                };

                var options = new RotateOptions
                {
                    FileInfo   = fileInfo,
                    OutputPath = "Output/rotate-pages.pdf",
                    Pages      = new List <int?> {
                        2, 4
                    },
                    Mode = RotateOptions.ModeEnum.Rotate90
                };
                var request = new RotateRequest(options);

                var response = apiInstance.Rotate(request);

                Console.WriteLine("Output file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new SecurityApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/password-protected.docx",
                    Password = "******"
                };

                var options = new UpdatePasswordOptions
                {
                    FileInfo    = fileInfo,
                    OutputPath  = "output/update-password.docx",
                    NewPassword = "******"
                };

                var request  = new UpdatePasswordRequest(options);
                var response = apiInstance.UpdatePassword(request);

                Console.WriteLine("Output file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new PagesApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/four-pages.docx"
                };

                var options = new OrientationOptions
                {
                    FileInfo   = fileInfo,
                    OutputPath = "Output/change-page-orientation.docx",
                    Pages      = new List <int?> {
                        2, 4
                    },
                    Mode = OrientationOptions.ModeEnum.Landscape
                };
                var request = new OrientationRequest(options);

                var response = apiInstance.Orientation(request);

                Console.WriteLine("Output file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
Пример #6
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new PagesApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/sample-10-pages.docx"
                };

                var options = new ExtractOptions
                {
                    FileInfo        = fileInfo,
                    OutputPath      = "Output/extract-pages-by-range.docx",
                    StartPageNumber = 1,
                    EndPageNumber   = 10,
                    RangeMode       = PageOptions.RangeModeEnum.EvenPages
                };
                var request = new ExtractRequest(options);

                var response = apiInstance.Extract(request);

                Console.WriteLine("Output file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new DocumentApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/four-pages.docx"
                };

                var options = new PreviewOptions()
                {
                    FileInfo   = fileInfo,
                    OutputPath = "Output/preview-page",
                    Pages      = new List <int?> {
                        1, 3
                    },
                    Format = PreviewOptions.FormatEnum.Png
                };

                var request  = new PreviewRequest(options);
                var response = apiInstance.Preview(request);

                foreach (var document in response.Documents)
                {
                    Console.WriteLine("Output file path: " + document.Path);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
Пример #8
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new PagesApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/sample-10-pages.docx"
                };

                var options = new ExtractOptions
                {
                    FileInfo   = fileInfo,
                    OutputPath = "Output/extract-pages-by-numbers.docx",
                    Pages      = new List <int?> {
                        2, 4, 7
                    }
                };
                var request = new ExtractRequest(options);

                var response = apiInstance.Extract(request);

                Console.WriteLine("Output file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new PagesApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/four-pages.docx"
                };

                var options = new SwapOptions
                {
                    FileInfo         = fileInfo,
                    OutputPath       = "Output/swap-pages.docx",
                    FirstPageNumber  = 2,
                    SecondPageNumber = 4
                };
                var request = new SwapRequest(options);

                var response = apiInstance.Swap(request);

                Console.WriteLine("Output file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }