public static void Run()
        {
            //ExStart:ConvertingPresentationToHtmlWithEmbedAllFontsHtmlController
            string dataDir = RunExamples.GetDataDir_Conversion();

            using (Presentation pres = new Presentation(dataDir + "presentation.pptx"))
            {
                // exclude default presentation fonts
                string[] fontNameExcludeList = { "Calibri", "Arial" };


                Paragraph para = new Paragraph();

                EmbedAllFontsHtmlController embedFontsController = new EmbedAllFontsHtmlController(fontNameExcludeList);

                LinkAllFontsHtmlController linkcont = new LinkAllFontsHtmlController(fontNameExcludeList, @"C:\Windows\Fonts\");

                HtmlOptions htmlOptionsEmbed = new HtmlOptions
                {
                    //                    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(embedFontsController)
                    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(linkcont)
                };

                pres.Save("pres.html", SaveFormat.Html, htmlOptionsEmbed);
                //ExEnd:ConvertingPresentationToHtmlWithEmbedAllFontsHtmlController
            }
        }
Exemplo n.º 2
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Conversion();

            // Loading a presentation
            using (Presentation pres = new Presentation(dataDir + "Media File.pptx"))
            {
                string       path     = dataDir;
                const string fileName = "ExportMediaFiles_out.html";
                const string baseUri  = "http://www.example.com/";

                VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path, fileName, baseUri);

                // Setting HTML options
                HtmlOptions htmlOptions = new HtmlOptions(controller);
                SVGOptions  svgOptions  = new SVGOptions(controller);

                htmlOptions.HtmlFormatter    = HtmlFormatter.CreateCustomFormatter(controller);
                htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);

                // Saving the file
                pres.Save(Path.Combine(path, fileName), SaveFormat.Html, htmlOptions);
            }
        }
Exemplo n.º 3
0
        //ExStart:ConvertIndividualSlide
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Conversion();

            using (Presentation presentation = new Presentation(dataDir + "Individual-Slide.pptx"))
            {
                HtmlOptions htmlOptions = new HtmlOptions();
                htmlOptions.HtmlFormatter = HtmlFormatter.CreateCustomFormatter(new CustomFormattingController());

                // Saving File
                for (int i = 0; i < presentation.Slides.Count; i++)
                {
                    presentation.Save(dataDir + "Individual Slide" + (i + 1) + "_out.html", new[] { i + 1 }, SaveFormat.Html, htmlOptions);
                }
            }
        }
Exemplo n.º 4
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Conversion();

            // Instantiate a Presentation object that represents a presentation file
            using (Presentation presentation = new Presentation(dataDir + "Convert_HTML.pptx"))
            {
                ResponsiveHtmlController controller = new ResponsiveHtmlController();
                HtmlOptions htmlOptions             = new HtmlOptions {
                    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(controller)
                };

                // Saving the presentation to HTML
                presentation.Save(dataDir + "ConvertPresentationToResponsiveHTML_out.html", SaveFormat.Html, htmlOptions);
            }
        }
Exemplo n.º 5
0
        public static void Run()
        {
            //ExStart:SavingHTMLAndCSSFileWhenExportingIntoHTML
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Conversion();

            using (Presentation pres = new Presentation("pres.pptx"))
            {
                CustomHeaderAndFontsController htmlController = new CustomHeaderAndFontsController("styles.css");
                HtmlOptions options = new HtmlOptions
                {
                    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(htmlController),
                };

                pres.Save("pres.html", SaveFormat.Html, options);
            }
        }
Exemplo n.º 6
0
        public static void Run()
        {
            //ExStart:ConvertWholePresentationToHTMLWithMediaFiles
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Conversion();
           const string htmlDocumentFileName = "presentationWithVideo.html";
          using (Presentation pres = new Presentation("presentationWith.pptx"))
        {
        VideoPlayerHtmlController controller = new VideoPlayerHtmlController(
        "", htmlDocumentFileName, "http://www.example.com/");

        HtmlOptions htmlOptions = new HtmlOptions(controller);
        SVGOptions svgOptions = new SVGOptions(controller);

        htmlOptions.HtmlFormatter = HtmlFormatter.CreateCustomFormatter(controller);
        htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);

        pres.Save(htmlDocumentFileName, SaveFormat.Html, htmlOptions);
}
            }
        public PresentationSlide GetViewerSlide(string filePath, int slideNumber)
        {
            using (var presentation = new Presentation(filePath))
                using (var stream = new MemoryStream())
                {
                    presentation.Save(stream, new[] { slideNumber }, SaveFormat.Html, new HtmlOptions
                    {
                        SvgResponsiveLayout = true,
                        HtmlFormatter       = HtmlFormatter.CreateCustomFormatter(new EmptyHtmlFormatter())
                    });

                    return(new PresentationSlide
                    {
                        Number = slideNumber,
                        Height = presentation.SlideSize.Size.Height,
                        Width = presentation.SlideSize.Size.Width,
                        Angle = 0,
                        Data = new UTF8Encoding(false).GetString(stream.ToArray())
                    });
                }
        }
        public static void Run()
        {
            //ExStart:ConvertingPresentationToHTMLWithPreservingOriginalFonts
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Conversion();

            using (Presentation pres = new Presentation("input.pptx"))
            {
                // exclude default presentation fonts
                string[] fontNameExcludeList = { "Calibri", "Arial" };

                EmbedAllFontsHtmlController embedFontsController = new EmbedAllFontsHtmlController(fontNameExcludeList);

                HtmlOptions htmlOptionsEmbed = new HtmlOptions
                {
                    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(embedFontsController)
                };

                pres.Save("input-PFDinDisplayPro-Regular-installed.html", SaveFormat.Html, htmlOptionsEmbed);
            }
            //ExEnd:ConvertingPresentationToHTMLWithPreservingOriginalFonts
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            //Loading a presentation
            using (Presentation pres = new Presentation("example.pptx"))
            {
                const string path     = "path";
                const string fileName = "video.html";
                const string baseUri  = "http://www.example.com/";

                VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path: path, fileName: fileName, baseUri: baseUri);

                //Setting HTML options
                HtmlOptions htmlOptions = new HtmlOptions(controller);
                SVGOptions  svgOptions  = new SVGOptions(controller);

                htmlOptions.HtmlFormatter    = HtmlFormatter.CreateCustomFormatter(controller);
                htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);

                //Saving the file
                pres.Save(path + fileName, SaveFormat.Html, htmlOptions);
            }
        }
        public static void Run()
        {
            // ExStart:EmbedFontsInHtml
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            using (Presentation pres = new Presentation(dataDir + "pres.pptx"))
            {
                // exclude default presentation fonts
                string[] fontNameExcludeList = { "Calibri", "Arial" };

                EmbedAllFontsHtmlController embedFontsController = new EmbedAllFontsHtmlController(fontNameExcludeList);

                HtmlOptions htmlOptionsEmbed = new HtmlOptions
                {
                    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(embedFontsController)
                };

                pres.Save(dataDir + "pres.html", SaveFormat.Html, htmlOptionsEmbed);
            }
            // ExEnd:EmbedFontsInHtml
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            string FilePath     = @"..\..\..\Sample Files\";
            string srcFileName  = FilePath + "Conversion.pptx";
            string destFileName = "video.html";

            //Loading a presentation
            using (Presentation pres = new Presentation(srcFileName))
            {
                const string baseUri = "http://www.example.com/";

                VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path: FilePath, fileName: destFileName, baseUri: baseUri);

                //Setting HTML options
                HtmlOptions htmlOptions = new HtmlOptions(controller);
                SVGOptions  svgOptions  = new SVGOptions(controller);

                htmlOptions.HtmlFormatter    = HtmlFormatter.CreateCustomFormatter(controller);
                htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);

                //Saving the file
                pres.Save(destFileName, SaveFormat.Html, htmlOptions);
            }
        }