Example #1
0
        public static IServiceCollection AddGeneralImageProvider(this IServiceCollection services, Action <GeneralImageOptions> optionsAction = null)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.TryAddSingleton <IImageProvider, GeneralImageProvider>();

            if (optionsAction != null)
            {
                GeneralImageOptions options = new GeneralImageOptions();
                optionsAction.Invoke(options);
                services.AddSingleton(options);
            }

            return(services);
        }
Example #2
0
 public async Task ToImageAsync(Stream html, string outputFile, GeneralImageOptions options) =>
 await _htmlToImageConverter.ConvertAsync(html, outputFile, options);