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()); }
public byte[] ConvertHtml(string html, HtmlConversionOptions options) { if (string.IsNullOrEmpty(html)) { throw new MissingSourceException("No html was specified."); } return ConvertHtmlList(new string[] { html }, options); }
public byte[] ConvertUrl(string url, HtmlConversionOptions options) { if (string.IsNullOrEmpty(url)) { throw new MissingSourceException("Url not specified."); } return(ConvertUrls(new string[] { url }, options)); }
public byte[] ConvertHtml(string html, HtmlConversionOptions options) { if (string.IsNullOrEmpty(html)) { throw new MissingSourceException("No html was specified."); } return(ConvertHtmlList(new string[] { html }, options)); }
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); } }
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); } }
public PedamorfResponse ConvertUrl(string url, HtmlConversionOptions options) { return GetResponse(x => x.ConvertUrl(url, options)); }
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; } }
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; } }
public byte[] ConvertUrl(string url, HtmlConversionOptions options) { if (string.IsNullOrEmpty(url)) { throw new MissingSourceException("Url not specified."); } return ConvertUrls(new string[] { url }, options); }