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); }
public async Task ToImageAsync(Stream html, string outputFile, GeneralImageOptions options) => await _htmlToImageConverter.ConvertAsync(html, outputFile, options);