Inheritance: ConversionOptions
コード例 #1
0
        protected virtual string GenerateOptionsArguments(ConversionOptions options)
        {
            StringBuilder arguments = new StringBuilder();

            if (options != null)
            {
                arguments.Append("--orientation ").Append(options.Orientation.ToString());

                if (options is HtmlConversionOptions)
                {
                    HtmlConversionOptions htmlOptions = (HtmlConversionOptions)options;
                    if (!string.IsNullOrEmpty(htmlOptions.HTTPAuthenticationUsername))
                    {
                        arguments.Append(" --username ").Append(htmlOptions.HTTPAuthenticationUsername);
                        arguments.Append(" --password ").Append(htmlOptions.HTTPAuthenticationPassword);
                    }

                    if (htmlOptions.PrintMediaType)
                    {
                        arguments.Append(" --print-media-type");
                    }

                    if (!string.IsNullOrEmpty(htmlOptions.UserStyleSheetUrl))
                    {
                        arguments.Append(" --user-style-sheet ").Append(htmlOptions.UserStyleSheetUrl);
                    }
                }
            }

            return(arguments.ToString());
        }
コード例 #2
0
ファイル: PdfConverter.cs プロジェクト: bradyholt/pedamorf
        public byte[] ConvertHtml(string html, HtmlConversionOptions options)
        {
            if (string.IsNullOrEmpty(html))
            {
                throw new MissingSourceException("No html was specified.");
            }

            return ConvertHtmlList(new string[] { html }, options);
        }
コード例 #3
0
        public byte[] ConvertUrl(string url, HtmlConversionOptions options)
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new MissingSourceException("Url not specified.");
            }

            return(ConvertUrls(new string[] { url }, options));
        }
コード例 #4
0
        public byte[] ConvertHtml(string html, HtmlConversionOptions options)
        {
            if (string.IsNullOrEmpty(html))
            {
                throw new MissingSourceException("No html was specified.");
            }

            return(ConvertHtmlList(new string[] { html }, options));
        }
コード例 #5
0
        public byte[] ConvertHtmlList(string[] html, HtmlConversionOptions options)
        {
            if (html == null || html.Length == 0)
            {
                throw new MissingSourceException("No html was specified.");
            }

            using (ConversionEngine engine = m_engineFactory.ConstructHtmlEngine(html))
            {
                engine.ConvertToPdf(options);
                return(engine.OutputFile);
            }
        }
コード例 #6
0
        public byte[] ConvertUrls(string[] urls, HtmlConversionOptions options)
        {
            if (urls == null || urls.Length == 0)
            {
                throw new MissingSourceException("No Urls were specified.");
            }

            foreach (string url in urls)
            {
                if (!IsAbsoluteUrl(url))
                {
                    throw new UnsupportedSourceException("The specified url is not an absolute path.", url.ToString());
                }
            }

            using (ConversionEngine engine = m_engineFactory.ConstructUrlEngine(urls))
            {
                engine.ConvertToPdf(options);
                return(engine.OutputFile);
            }
        }
コード例 #7
0
ファイル: PedamorfService.cs プロジェクト: bradyholt/pedamorf
 public PedamorfResponse ConvertUrl(string url, HtmlConversionOptions options)
 {
     return GetResponse(x => x.ConvertUrl(url, options));
 }
コード例 #8
0
ファイル: PdfConverter.cs プロジェクト: bradyholt/pedamorf
        public byte[] ConvertHtmlList(string[] html, HtmlConversionOptions options)
        {
            if (html == null || html.Length == 0)
            {
                throw new MissingSourceException("No html was specified.");
            }

            using (ConversionEngine engine = m_engineFactory.ConstructHtmlEngine(html))
            {
                engine.ConvertToPdf(options);
                return engine.OutputFile;
            }
        }
コード例 #9
0
ファイル: PdfConverter.cs プロジェクト: bradyholt/pedamorf
        public byte[] ConvertUrls(string[] urls, HtmlConversionOptions options)
        {
            if (urls == null || urls.Length == 0)
            {
                throw new MissingSourceException("No Urls were specified.");
            }

            foreach (string url in urls)
            {
                if (!IsAbsoluteUrl(url))
                {
                    throw new UnsupportedSourceException("The specified url is not an absolute path.", url.ToString());
                }
            }

            using (ConversionEngine engine = m_engineFactory.ConstructUrlEngine(urls))
            {
                engine.ConvertToPdf(options);
                return engine.OutputFile;
            }
        }
コード例 #10
0
ファイル: PdfConverter.cs プロジェクト: bradyholt/pedamorf
        public byte[] ConvertUrl(string url, HtmlConversionOptions options)
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new MissingSourceException("Url not specified.");
            }

            return ConvertUrls(new string[] { url }, options);
        }