Skip to content

kdcllc/Bet.Extensions.Wkhtmltopdf

Repository files navigation

Bet.Extensions.Wkhtmltopdf

Build status NuGet Nuget feedz.io

The second letter in the Hebrew alphabet is the ב bet/beit. Its meaning is "house". In the ancient pictographic Hebrew it was a symbol resembling a tent on a landscape.

Note: Pre-release packages are distributed via feedz.io.

Summary

The purpose of this project is to provide a wrapper around wkhtmltopdf html to pdf generator.

Hire me

Please send email if you consider to hire me.

buymeacoffee

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

Install

    dotnet add package Bet.Extensions.Wkhtmltopdf

Usage

  1. In Startup.cs or Program.cs please register the service.
    services.AddPdfGenerator();
  1. Then use within components
    var byteArray = await _pdfGenerator.GetAsync(html, stoppingToken);

    var fileName = Path.Combine(AppContext.BaseDirectory, $"{Guid.NewGuid().ToString()}.pdf");

    using var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
    fs.Write(byteArray, 0, byteArray.Length);

WSL Linux

    sudo apt-get install libjpeg62

Benchmark

For details on the benchmarking this project please refer to Benchmarks.

References