示例#1
0
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "cmx_result_{0}.html");

            // TO HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CMX))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);

                viewer.View(options);

                // To render 2nd image, just specify
                //viewer.View(options,2);
            }

            // TO JPG
            pageFilePathFormat = Path.Combine(outputDirectory, "cmx_result_{0}.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CMX))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);

                viewer.View(options);

                // To render 2nd image, just specify
                //viewer.View(options,2);
            }

            // TO PNG
            pageFilePathFormat = Path.Combine(outputDirectory, "cmx_result_{0}.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CMX))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);

                viewer.View(options);

                // To render 2nd image, just specify
                //viewer.View(options,2);
            }

            // TO PDF
            pageFilePathFormat = Path.Combine(outputDirectory, "cmx_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CMX))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);

                viewer.View(options);

                // By default all images will be rendered in output.pdf, to render only 2nd image in output PDF
                //viewer.View(options,2);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
        public static void Run()
        {
            string outputDirectory  = Utils.GetOutputDirectoryPath();
            string pageFileFullPath = Path.Combine(outputDirectory, "Txt_result.html");

            // TO MULTI PAGES HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_TXT))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFileFullPath);

                viewer.View(options);
            }

            pageFileFullPath = Path.Combine(outputDirectory, "Txt_result_single_page.html");

            // TO SINGLE HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_2_TXT))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFileFullPath);
                options.RenderToSinglePage = true;

                viewer.View(options);
            }

            // TO JPG
            pageFileFullPath = Path.Combine(outputDirectory, "Txt_result.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_TXT))
            {
                JpgViewOptions options = new JpgViewOptions(pageFileFullPath);

                viewer.View(options);
            }

            // TO PNG
            pageFileFullPath = Path.Combine(outputDirectory, "Txt_result.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_TXT))
            {
                PngViewOptions options = new PngViewOptions(pageFileFullPath);

                viewer.View(options);
            }

            // TO PDF
            pageFileFullPath = Path.Combine(outputDirectory, "Txt_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_TXT))
            {
                PdfViewOptions options = new PdfViewOptions(pageFileFullPath);

                viewer.View(options);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
示例#3
0
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "result_page.html");

            // TO HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_VISIO))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
                options.VisioRenderingOptions.RenderFiguresOnly = true;
                options.VisioRenderingOptions.FigureWidth       = 250;

                viewer.View(options);
            }

            // TO JPG
            pageFilePathFormat = Path.Combine(outputDirectory, "visio_result.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_VISIO))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
                options.VisioRenderingOptions.RenderFiguresOnly = true;
                options.VisioRenderingOptions.FigureWidth       = 250;

                viewer.View(options);
            }

            // TO PNG
            pageFilePathFormat = Path.Combine(outputDirectory, "visio_result.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_VISIO))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);
                options.VisioRenderingOptions.RenderFiguresOnly = true;
                options.VisioRenderingOptions.FigureWidth       = 250;

                viewer.View(options);
            }

            // TO PDF
            pageFilePathFormat = Path.Combine(outputDirectory, "visio_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_VISIO))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
                options.VisioRenderingOptions.RenderFiguresOnly = true;
                options.VisioRenderingOptions.FigureWidth       = 250;

                viewer.View(options);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
                viewer.View(options);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
示例#5
0
        public static void Run()
        {
            string outputDirectory  = Utils.GetOutputDirectoryPath();
            string pageFileFullPath = Path.Combine(outputDirectory, "Excel_2003_Xml_result.html");

            /* Because the XML extension is associated with both an XML text document and Excel 2003 XML SpreadSheetML,
             * please specify the Excel2003XML fileType explicitly to render it as Excel 2003 XML SpreadSheetML.
             */

            LoadOptions loadOptions = new LoadOptions(FileType.Excel2003XML);

            // TO MULTI PAGES HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XML_SPREADSHEETML, loadOptions))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFileFullPath);

                viewer.View(options);
            }

            // TO JPG
            pageFileFullPath = Path.Combine(outputDirectory, "Excel_2003_Xml_result.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XML_SPREADSHEETML, loadOptions))
            {
                JpgViewOptions options = new JpgViewOptions(pageFileFullPath);

                viewer.View(options);
            }

            // TO PNG
            pageFileFullPath = Path.Combine(outputDirectory, "Excel_2003_Xml_result.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XML_SPREADSHEETML, loadOptions))
            {
                PngViewOptions options = new PngViewOptions(pageFileFullPath);

                viewer.View(options);
            }

            // TO PDF
            pageFileFullPath = Path.Combine(outputDirectory, "Excel_2003_Xml_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XML_SPREADSHEETML, loadOptions))
            {
                PdfViewOptions options = new PdfViewOptions(pageFileFullPath);

                viewer.View(options);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.html");

            // TO HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XLSX))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
                options.SpreadsheetOptions.RenderHeadings = true;

                viewer.View(options, 1, 2, 3);
            }

            // TO JPG
            pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XLSX))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
                options.SpreadsheetOptions.RenderHeadings = true;

                viewer.View(options, 1, 2, 3);
            }

            // TO PNG
            pageFilePathFormat = Path.Combine(outputDirectory, "page_{0}.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XLSX))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);
                options.SpreadsheetOptions.RenderHeadings = true;

                viewer.View(options, 1, 2, 3);
            }

            // TO PDF
            pageFilePathFormat = Path.Combine(outputDirectory, "output.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_XLSX))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
                options.SpreadsheetOptions.RenderHeadings = true;

                viewer.View(options, 1, 2, 3);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "chm_result_{0}.html");

            // TO HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CHM))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
                options.RenderToSinglePage = true; // Enable it if you want to convert all CHM content to single page

                //viewer.View(options,1,2,3); // Convert only 1,2,3 pages
                viewer.View(options);  // Convert all pages
            }

            // TO JPG
            pageFilePathFormat = Path.Combine(outputDirectory, "chm_result_{0}.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CHM))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);

                viewer.View(options, 1, 2, 3); // Convert only 1,2,3 pages
                //viewer.View(options); // Convert all pages
            }

            // TO PNG
            pageFilePathFormat = Path.Combine(outputDirectory, "chm_result_{0}.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CHM))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);

                viewer.View(options, 1, 2, 3); // Convert only 1,2,3 pages
                //viewer.View(options); // Convert all pages
            }

            // TO PDF
            pageFilePathFormat = Path.Combine(outputDirectory, "chm_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_CHM))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);

                viewer.View(options); // Convert all pages
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
示例#8
0
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "RAR_result_{0}.html");

            // TO HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_RAR_WITH_FOLDERS))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);

                viewer.View(options);
            }

            // TO JPG
            pageFilePathFormat = Path.Combine(outputDirectory, "RAR_result_{0}.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_RAR_WITH_FOLDERS))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);

                viewer.View(options);
            }

            // TO PNG
            pageFilePathFormat = Path.Combine(outputDirectory, "RAR_result_{0}.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_RAR_WITH_FOLDERS))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);

                viewer.View(options);
            }

            // TO PDF
            pageFilePathFormat = Path.Combine(outputDirectory, "RAR_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_RAR_WITH_FOLDERS))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);

                viewer.View(options);
            }

            GetViewInfoForRar();
            RenderSpecificArchiveFolder();

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "hpg_result.html");

            // TO HTML
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HPG))
            {
                HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
                //options.CadOptions = CadOptions.ForRenderingByScaleFactor(0.7f); // Render image and reduce it by 30%
                //options.CadOptions = CadOptions.ForRenderingByWidthAndHeight(400,400); // Render image and set output size to 400x400
                //options.CadOptions = CadOptions.ForRenderingByWidth(500); // Render image, fix width by 500 px and recalculate height
                //options.CadOptions = CadOptions.ForRenderingByHeight(500); // Render image, fix height by 500 px and recalculate width

                viewer.View(options);
            }

            // TO JPG
            pageFilePathFormat = Path.Combine(outputDirectory, "hpg_result.jpg");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HPG))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
                //options.CadOptions = CadOptions.ForRenderingByScaleFactor(0.7f); // Render image and reduce it by 30%
                //options.CadOptions = CadOptions.ForRenderingByWidthAndHeight(400,400); // Render image and set output size to 400x400
                //options.CadOptions = CadOptions.ForRenderingByWidth(500); // Render image, fix width by 500 px and recalculate height
                //options.CadOptions = CadOptions.ForRenderingByHeight(500); // Render image, fix height by 500 px and recalculate width

                viewer.View(options);
            }

            // TO PNG
            pageFilePathFormat = Path.Combine(outputDirectory, "hpg_result.png");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HPG))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);
                //options.CadOptions = CadOptions.ForRenderingByScaleFactor(0.7f); // Render image and reduce it by 30%
                //options.CadOptions = CadOptions.ForRenderingByWidthAndHeight(400,400); // Render image and set output size to 400x400
                //options.CadOptions = CadOptions.ForRenderingByWidth(500); // Render image, fix width by 500 px and recalculate height
                //options.CadOptions = CadOptions.ForRenderingByHeight(500); // Render image, fix height by 500 px and recalculate width

                viewer.View(options);
            }

            // TO PDF
            pageFilePathFormat = Path.Combine(outputDirectory, "hpg_result.pdf");

            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HPG))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
                //options.CadOptions = CadOptions.ForRenderingByScaleFactor(0.7f); // Render image and reduce it by 30%
                //options.CadOptions = CadOptions.ForRenderingByWidthAndHeight(400,400); // Render image and set output size to 400x400
                //options.CadOptions = CadOptions.ForRenderingByWidth(500); // Render image, fix width by 500 px and recalculate height
                //options.CadOptions = CadOptions.ForRenderingByHeight(500); // Render image, fix height by 500 px and recalculate width

                viewer.View(options);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }
        public static void Run()
        {
            string outputDirectory    = Utils.GetOutputDirectoryPath();
            string pageFilePathFormat = Path.Combine(outputDirectory, "html_render_margins_page_{0}.jpg");

            /*
             * You can adjust margins (top,bottom,left,right) of final document by setting following properties in
             * options.WordProcessingOptions:
             *
             * LeftMargin
             * RightMargin
             * TopMargin
             * BottomMargin
             *
             * Default values in points are:
             * LeftMargin = RightMargin = 5
             * TopMargin = BottomMargin = 72
             */

            // TO JPG
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HTML))
            {
                JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
                options.WordProcessingOptions.LeftMargin   = 40;
                options.WordProcessingOptions.RightMargin  = 40;
                options.WordProcessingOptions.TopMargin    = 40;
                options.WordProcessingOptions.BottomMargin = 40;

                viewer.View(options);
            }

            pageFilePathFormat = Path.Combine(outputDirectory, "html_render_margins_page_{0}.png");

            // TO PNG
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HTML))
            {
                PngViewOptions options = new PngViewOptions(pageFilePathFormat);
                options.WordProcessingOptions.LeftMargin   = 40;
                options.WordProcessingOptions.RightMargin  = 40;
                options.WordProcessingOptions.TopMargin    = 40;
                options.WordProcessingOptions.BottomMargin = 40;

                viewer.View(options);
            }

            pageFilePathFormat = Path.Combine(outputDirectory, "html_render_margins.pdf");

            // TO PDF
            using (Viewer viewer = new Viewer(TestFiles.SAMPLE_HTML))
            {
                PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
                options.WordProcessingOptions.LeftMargin   = 40;
                options.WordProcessingOptions.RightMargin  = 40;
                options.WordProcessingOptions.TopMargin    = 40;
                options.WordProcessingOptions.BottomMargin = 40;

                viewer.View(options);
            }

            Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}.");
        }