Exemplo n.º 1
0
 protected override void Render(RenderingWorkUnit[] workUnits, ConversionApplicationOptions options, string outputFilePath)
 {
     using (var renderer = new HtmlRenderer())
         using (var device = GetOutputDevice(options, outputFilePath))
         {
             renderer.Render(device, ConversionApplication.DEFAULT_RENDERING_TIMEOUT,
                             workUnits.Cast <MarkdownDocumentRenderingWorkUnit>().Select(x => x.Data).ToArray());
         }
 }
Exemplo n.º 2
0
        protected override void Render(RenderingWorkUnit workUnit, ConversionApplicationOptions options, string outputFilePath)
        {
            var wi = ((UrlWorkUnit)workUnit);

            using (var document = new HTMLDocument(wi.Data, GetConfiguration(options)))
            {
                document.Save(outputFilePath, HTMLSaveFormat.MHTML);
            }
        }
Exemplo n.º 3
0
        protected override void Render(RenderingWorkUnit workUnit, ConversionApplicationOptions options, string outputFilePath)
        {
            var wi = ((StreamRenderingWorkUnit)workUnit);

            using (var renderer = new MhtmlRenderer())
                using (var device = GetOutputDevice(options, outputFilePath))
                {
                    renderer.Render(device, wi.Data, ConversionApplication.DEFAULT_RENDERING_TIMEOUT);
                }
        }
Exemplo n.º 4
0
        protected override Configuration GetConfiguration(ConversionApplicationOptions options)
        {
            var configuration = base.GetConfiguration(options);

            if (!string.IsNullOrEmpty(options.MarkdowTheme))
            {
                var filePath = System.Web.Hosting.HostingEnvironment.MapPath($"~/App_Data/MDThemes/{options.MarkdowTheme}.css");
                if (File.Exists(filePath))
                {
                    configuration.GetService <IUserAgentService>().UserStyleSheet = File.ReadAllText(filePath);
                }
            }

            return(configuration);
        }
Exemplo n.º 5
0
        protected override void Render(RenderingWorkUnit workUnit, ConversionApplicationOptions options, string outputFilePath)
        {
            var wi = ((MarkdownDocumentRenderingWorkUnit)workUnit);

            if (options.OutputFormat == FileFormat.HTML)
            {
                wi.Data.Save(outputFilePath, HTMLSaveFormat.HTML);
            }
            else
            {
                using (var renderer = new HtmlRenderer())
                    using (var device = GetOutputDevice(options, outputFilePath))
                    {
                        renderer.Render(device, wi.Data, ConversionApplication.DEFAULT_RENDERING_TIMEOUT);
                    }
            }
        }
Exemplo n.º 6
0
 protected override void Render(RenderingWorkUnit[] workUnits, ConversionApplicationOptions options, string outputFilePath)
 {
     ConversionHelper.Merge(
         workUnits.Cast <UrlWorkUnit>().Select(x => x.Data).ToArray(),
         outputFilePath);
 }