Ejemplo n.º 1
0
        /// <summary>
        /// Convert a URL to PDF
        /// </summary>
        /// Fully renders a website and returns a PDF of the full page.  Javascript,
        /// HTML5, CSS and other advanced features are all supported.
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='input'>
        /// URL to PDF request parameters
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <System.IO.Stream> UrlToPdfAsync(this IConvertWeb operations, Input input, CancellationToken cancellationToken = default(CancellationToken))
        {
            var _result = await operations.UrlToPdfWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false);

            _result.Request.Dispose();
            return(_result.Body);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Convert HTML string to PDF
 /// </summary>
 /// Fully renders a website and returns a PDF of the HTML.  Javascript, HTML5,
 /// CSS and other advanced features are all supported.
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='input'>
 /// HTML to PDF request parameters
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> HtmlToPdfAsync(this IConvertWeb operations, Input input, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.HtmlToPdfWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Convert a URL to PDF
 /// </summary>
 /// Fully renders a website and returns a PDF of the full page.  Javascript,
 /// HTML5, CSS and other advanced features are all supported.
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='input'>
 /// URL to PDF request parameters
 /// </param>
 public static System.IO.Stream UrlToPdf(this IConvertWeb operations, Input input)
 {
     return(Task.Factory.StartNew(s => ((IConvertWeb)s).UrlToPdfAsync(input), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }