public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.ost"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        OutlookOptions = new OutlookOptions
                        {
                            MaxItemsInFolder = 1000
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("LimitCountOfItemsToRender completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.HTML,

                    Watermark = new Watermark
                    {
                        Text = "This is a watermark"
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("AddWatermark completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.ost"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        OutlookOptions = new OutlookOptions
                        {
                            TextFilter    = "Microsoft",
                            AddressFilter = "susan"
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("FilterMessages completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 4
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/with_folders.zip"
                    },
                    RenderOptions = new RenderOptions
                    {
                        ArchiveOptions = new ArchiveOptions
                        {
                            Folder = "ThirdFolderWithItems"
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));

                Console.WriteLine("RenderArchiveFolder completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 5
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/with_layers_and_layouts.dwg"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        CadOptions = new CadOptions
                        {
                            ScaleFactor = 0.3
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("AdjustOutputImageSize completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 6
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.xlsx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        SpreadsheetOptions = new SpreadsheetOptions
                        {
                            TextOverflowMode = SpreadsheetOptions.TextOverflowModeEnum.HideText
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("AdjustTextOverflowInCells completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 7
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/shift_jis_encoded.txt"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new RenderOptions
                    {
                        DefaultEncoding = "shift_jis"
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("SpecifyEncoding completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.mpp"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        ProjectManagementOptions = new ProjectManagementOptions
                        {
                            TimeUnit = ProjectManagementOptions.TimeUnitEnum.Days
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("AdjustTimeUnit completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 9
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/with_empty_column.xlsx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        SpreadsheetOptions = new SpreadsheetOptions
                        {
                            RenderEmptyColumns = false
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("SkipRenderingOfEmptyColumns completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 10
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.PDF,

                    RenderOptions = new RenderOptions
                    {
                        PageRotations = new List <PageRotation>
                        {
                            new PageRotation
                            {
                                PageNumber    = 1,
                                RotationAngle = PageRotation.RotationAngleEnum.On90Degree
                            }
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("FlipRotatePages completed: " + response.File.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 11
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/with_tracked_changes.docx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        WordProcessingOptions = new WordProcessingOptions
                        {
                            RenderTrackedChanges = true
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderTrackedChanges completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 12
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.pdf"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        PdfDocumentOptions = new PdfDocumentOptions
                        {
                            DisableCharsGrouping = true
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("DisableCharsGrouping completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new ViewApi(configuration);

            try
            {
                var viewOptions = new ViewOptions()
                {
                    FileInfo = new FileInfo()
                    {
                        FilePath    = "viewerdocs/with-hidden-rows-and-columns.xlsx",
                        Password    = "",
                        StorageName = Common.MyStorage
                    },
                    RenderOptions = new RenderOptions()
                    {
                        SpreadsheetOptions = new SpreadsheetOptions()
                        {
                            PaginateSheets   = true,
                            CountRowsPerPage = 5
                        }
                    }
                };

                var request = new CreateViewRequest(viewOptions);

                var response = apiInstance.CreateView(request);
                Console.WriteLine("Expected response type is ViewResult: " + response.Pages.Count.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling ViewApi: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/with_hidden_page.pptx"
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.HTML,

                    RenderOptions = new RenderOptions
                    {
                        RenderHiddenPages = true
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderHiddenPages completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.pdf"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.PNG,
                    RenderOptions = new ImageOptions
                    {
                        PdfDocumentOptions = new PdfDocumentOptions
                        {
                            RenderOriginalPageSize = true
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderOriginalPageSize completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.msg"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.PDF,
                    RenderOptions = new PdfOptions
                    {
                        EmailOptions = new EmailOptions
                        {
                            PageSize = EmailOptions.PageSizeEnum.A4
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("AdjustPageSize completed: " + response.File.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 17
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new ViewApi(configuration);

            try
            {
                var viewOptions = new ViewOptions()
                {
                    FileInfo = new FileInfo()
                    {
                        FilePath    = "viewerdocs/three-layouts.dwf",
                        Password    = "",
                        StorageName = Common.MyStorage
                    },
                    RenderOptions = new HtmlOptions()
                    {
                        IsResponsive = true
                    }
                };

                var request = new CreateViewRequest(viewOptions);

                var response = apiInstance.CreateView(request);
                Console.WriteLine("Expected response type is ViewResult: " + response.Pages.Count.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling ViewApi: " + e.Message);
            }
        }
Exemplo n.º 18
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.PDF,
                    RenderOptions = new PdfOptions
                    {
                        Permissions = new List <string> {
                            "DenyModification"
                        },
                        PermissionsPassword  = "******",
                        DocumentOpenPassword = "******"
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("PdfViewerProtectPdf completed: " + response.File.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 19
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        FontsToExclude = new List <string> {
                            "Times New Roman"
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("HtmlViewerExcludeFonts completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 20
0
        public void TestCreateViewWithProjectOptions()
        {
            // Arrange
            var testFile    = TestFiles.ProjectMpp;
            var viewOptions = new ViewOptions
            {
                FileInfo      = testFile.ToFileInfo(),
                RenderOptions = new RenderOptions
                {
                    ProjectManagementOptions = new ProjectManagementOptions
                    {
                        PageSize  = ProjectManagementOptions.PageSizeEnum.Unspecified,
                        TimeUnit  = ProjectManagementOptions.TimeUnitEnum.Months,
                        StartDate = new DateTime(2008, 7, 1),
                        EndDate   = new DateTime(2008, 7, 31)
                    }
                }
            };
            var request = new CreateViewRequest(viewOptions);

            // Act & Assert
            var viewResult = ViewApi.CreateView(request);

            Assert.IsTrue(viewResult.Pages.Count == 1 || viewResult.Pages.Count == 2);
        }
Exemplo n.º 21
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        IsResponsive = true
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("HtmlViewerResponsiveLayout completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 22
0
        public void TestCreateViewWithHtmlViewOptions()
        {
            // Arrange
            var testFile    = TestFiles.OnePageDocx;
            var viewOptions = new ViewOptions
            {
                FileInfo      = testFile.ToFileInfo(),
                RenderOptions = new HtmlOptions {
                    ExternalResources = true
                }
            };

            var request = new CreateViewRequest(viewOptions);

            // Act & Assert
            var viewResult = ViewApi.CreateView(request);

            Assert.AreEqual(1, viewResult.Pages.Count);
            Assert.AreEqual(0, viewResult.Attachments.Count);

            var page = viewResult.Pages[0];

            Assert.AreEqual(1, page.Number);
            Assert.Greater(page.Resources.Count, 0);
        }
Exemplo n.º 23
0
        public static void Run(ViewOptions.ViewFormatEnum format)
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new ViewApi(configuration);

            try
            {
                var viewOptions = new ViewOptions()
                {
                    FileInfo = new FileInfo()
                    {
                        FilePath    = "viewerdocs/one-page.docx",
                        Password    = "",
                        StorageName = Common.MyStorage
                    },
                    ViewFormat = format
                };

                var request = new CreateViewRequest(viewOptions);

                var response = apiInstance.CreateView(request);
                Console.WriteLine("Expected response type is ViewResult: " + response.Pages.Count.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling ViewApi: " + e.Message);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Tests create view against two options with compare results
        /// </summary>
        private void TestCompareOptions(TestFile testFile, RenderOptions options1, RenderOptions options2)
        {
            var viewOptions1 = new ViewOptions
            {
                FileInfo      = testFile.ToFileInfo(),
                RenderOptions = options1
            };
            var viewResult1 = ViewApi.CreateView(new CreateViewRequest(viewOptions1));
            var response1   = FileApi.DownloadFile(new DownloadFileRequest {
                path = viewResult1.Pages[0].Path
            });

            Assert.Greater(response1.Length, 0);

            Cleanup();

            var viewOptions2 = new ViewOptions
            {
                FileInfo      = testFile.ToFileInfo(),
                RenderOptions = options2
            };
            var viewResult2 = ViewApi.CreateView(new CreateViewRequest(viewOptions2));
            var response2   = FileApi.DownloadFile(new DownloadFileRequest {
                path = viewResult2.Pages[0].Path
            });

            Assert.Greater(response2.Length, 0);

            Assert.AreNotEqual(response1.Length, response2.Length);
        }
Exemplo n.º 25
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/with_missing_font.pptx"
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.HTML,

                    RenderOptions = new RenderOptions
                    {
                        DefaultFontName = "Courier New"
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("ReplaceMissingFont completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 26
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.vssx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.PNG,
                    RenderOptions = new ImageOptions()
                    {
                        VisioRenderingOptions = new VisioRenderingOptions
                        {
                            RenderFiguresOnly = true,
                            FigureWidth       = 250
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderVisioDocumentFigures completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.HTML,

                    RenderOptions = new RenderOptions
                    {
                        StartPageNumber    = 1,
                        CountPagesToRender = 2
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderConsecutivePages completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Exemplo n.º 28
0
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.docx"
                    },
                    ViewFormat = ViewOptions.ViewFormatEnum.HTML,

                    RenderOptions = new RenderOptions
                    {
                        // Pass page numbers in the order you want to render them
                        PagesToRender = new List <int?> {
                            2, 1
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("ReorderPages completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.xlsx"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        SpreadsheetOptions = new SpreadsheetOptions
                        {
                            RenderGridLines = true
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderSpreadsheetWithGridLines completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public static void Run()
        {
            var apiInstance = new ViewApi(Constants.GetConfig());

            try
            {
                var viewOptions = new ViewOptions
                {
                    FileInfo = new FileInfo
                    {
                        FilePath = "SampleFiles/sample.mpp"
                    },
                    ViewFormat    = ViewOptions.ViewFormatEnum.HTML,
                    RenderOptions = new HtmlOptions
                    {
                        ProjectManagementOptions = new ProjectManagementOptions
                        {
                            StartDate = new DateTime(2008, 6, 1),
                            EndDate   = new DateTime(2008, 7, 1)
                        }
                    }
                };

                var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
                Console.WriteLine("RenderTimeInterval completed: " + response.Pages.Count);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }