public void TestGetPages(string filePath, PreviewOptions.FormatEnum?format = null, List <int?> pageNumbersToConvert = null,
                                 bool withoutAnnotations = false, int width       = 0, int height = 0,
                                 bool renderComments     = false, string password = null)
        {
            var fileInfo = new Model.FileInfo
            {
                FilePath = filePath,
                Password = password
            };
            var options = new PreviewOptions
            {
                FileInfo       = fileInfo,
                Format         = format,
                Height         = height,
                Width          = width,
                PageNumbers    = pageNumbersToConvert,
                RenderComments = renderComments
            };
            var request = new GetPagesRequest(options);
            var result  = PreviewApi.GetPages(request);

            Assert.NotNull(result);
            Assert.Greater(result.TotalCount, 0);
            Assert.NotNull(result.Entries);
            Assert.Greater(result.Entries.Count, 0);
        }
Esempio n. 2
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new PreviewApi(configuration);

            try
            {
                // Set request.
                var request = new GetPagesRequest()
                {
                    filePath            = "Annotationdocs\\ten-pages.docx",
                    password            = null,
                    pageNumber          = 1,
                    countPagesToConvert = 1,
                    enableCaching       = false,
                    cacheStoragePath    = null,
                    withoutAnnotations  = true
                };

                var response = apiInstance.GetPages(request);
                Console.WriteLine("Expected response type is PageImages: " + response.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling Annotation PreviewApi: " + e.Message);
            }
        }
Esempio n. 3
0
        public static void Run()
        {
            var apiInstance = new PreviewApi(Constants.GetConfig());

            try
            {
                var fileInfo = new FileInfo {
                    FilePath = "one-page.docx"
                };
                var options = new PreviewOptions {
                    FileInfo = fileInfo
                };

                var request = new GetPagesRequest(options);

                var response = apiInstance.GetPages(request);
                Console.WriteLine("GetPages: pages count = " + response.TotalCount);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling Annotation PreviewApi: " + e.Message);
            }
        }