Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Latest commit

 

History

History
23 lines (18 loc) · 493 Bytes

README.md

File metadata and controls

23 lines (18 loc) · 493 Bytes

Build

dotnet pack

Usage

using WkHtmlToX;

var settings = new PdfGlobalSettings();
settings.PageSize = PageSize.Letter;
settings.Orientation = Orientation.Landscape;
settings.ColorMode = ColorMode.Color;

var inFile = "template.html";
var outFile = "output.pdf";

using (var converter = new HtmlToPdfConverter(settings))
{
    var html = System.IO.File.ReadAllText(inFile);
    var data = converter.ConvertToPDF(html);
    System.IO.File.WriteAllBytes(outFile, data);
}