SolidCompany.Wrappers.WkHtmlToImage 1.3.11

.NET Core wrapper for wkhtmltoimage

Install-Package SolidCompany.Wrappers.WkHtmlToImage -Version 1.3.11
dotnet add package SolidCompany.Wrappers.WkHtmlToImage --version 1.3.11
<PackageReference Include="SolidCompany.Wrappers.WkHtmlToImage" Version="1.3.11" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SolidCompany.Wrappers.WkHtmlToImage --version 1.3.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SolidCompany.Wrappers.WkHtmlToImage, 1.3.11"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SolidCompany.Wrappers.WkHtmlToImage as a Cake Addin
#addin nuget:?package=SolidCompany.Wrappers.WkHtmlToImage&version=1.3.11

// Install SolidCompany.Wrappers.WkHtmlToImage as a Cake Tool
#tool nuget:?package=SolidCompany.Wrappers.WkHtmlToImage&version=1.3.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SolidCompany.Wrappers.WkHtmlToImage is a .NET Core wrapper for a part of an open-source project wkhtmltopdf which is wkhtmltoimage. It supports converting an HTML to images in a selected format.

Get Packages

You can get SolidCompany.Wrappers.WkHtmlToImage package by downloading it from NuGet feed.

Getting Started

SolidCompany.Wrappers.WkHtmlToImage easily integrates with .NET Core Dependency Injection. You need only one line of code to get everything working:

public void ConfigureServices(IServiceCollection services)
{
    // ...
    
    services.AddHtmlToImageConversion();

    // ...
}

Now you are free to use this powerful tool by injecting IHtmlToImage into a constructor:

public class SampleService
{
    private readonly IHtmlToImage htmlToImage;

    public SampleService(IHtmlToImage htmlToImage)
    {
        this.htmlToImage = htmlToImage;
    }

    public async Task<Stream> ConvertHtmlToImageAsync(string html, int widthPx)
    {
        return await htmlToImage.CreateImageAsync(html, widthPx, ImageFormat.Png);
    }
}

Image height is automatically scaled to width which preserves a valid ratio.

Configuration

You can pass a few additional options to configuration:


services.AddHtmlToImageConversion(options =>
{
    options.DependencyLogger = new ApplicationInsightsDependencyLogger();
    options.ExecutionTimeout = TimeSpan.FromMinutes(2);
    options.ExectuionDirectory = new CustomDirectory("C:/Temp");
});

DependencyLogger allows to track every wkhtmltoimage call with Azure Application Insights. To use it you need SolidCompany.Wrappers.Logging.ApplicationInsights package.

ExecutionTimeout lets you specify a maximum wkhtmltoimage execution time. Default is 30 seconds.

ExectuionDirectory specifies where the exe file is run and where temporary files are created. By default %TEMP%\SolidCompany.Wrappers.WkHtmlToImage directory is used.

SolidCompany.Wrappers.WkHtmlToImage is a .NET Core wrapper for a part of an open-source project wkhtmltopdf which is wkhtmltoimage. It supports converting an HTML to images in a selected format.

Get Packages

You can get SolidCompany.Wrappers.WkHtmlToImage package by downloading it from NuGet feed.

Getting Started

SolidCompany.Wrappers.WkHtmlToImage easily integrates with .NET Core Dependency Injection. You need only one line of code to get everything working:

public void ConfigureServices(IServiceCollection services)
{
    // ...
    
    services.AddHtmlToImageConversion();

    // ...
}

Now you are free to use this powerful tool by injecting IHtmlToImage into a constructor:

public class SampleService
{
    private readonly IHtmlToImage htmlToImage;

    public SampleService(IHtmlToImage htmlToImage)
    {
        this.htmlToImage = htmlToImage;
    }

    public async Task<Stream> ConvertHtmlToImageAsync(string html, int widthPx)
    {
        return await htmlToImage.CreateImageAsync(html, widthPx, ImageFormat.Png);
    }
}

Image height is automatically scaled to width which preserves a valid ratio.

Configuration

You can pass a few additional options to configuration:


services.AddHtmlToImageConversion(options =>
{
    options.DependencyLogger = new ApplicationInsightsDependencyLogger();
    options.ExecutionTimeout = TimeSpan.FromMinutes(2);
    options.ExectuionDirectory = new CustomDirectory("C:/Temp");
});

DependencyLogger allows to track every wkhtmltoimage call with Azure Application Insights. To use it you need SolidCompany.Wrappers.Logging.ApplicationInsights package.

ExecutionTimeout lets you specify a maximum wkhtmltoimage execution time. Default is 30 seconds.

ExectuionDirectory specifies where the exe file is run and where temporary files are created. By default %TEMP%\SolidCompany.Wrappers.WkHtmlToImage directory is used.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.3.11 75 6/9/2021
1.3.7 101 5/9/2021
1.3.6 70 4/24/2021
1.3.5 127 4/18/2021
1.3.4 54 4/18/2021