jacklmjie / dotnet-HtmlToPDFCore

Convert HTML to PDF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nuget count .NET Core

linux wkhtmltopdf 运行报错

HtmlToPDFCore

Convert HTML to PDF

This package is huge because include Rotativa files for Windows, Linux and MAC.

Using this tool you can convert an HTML file to PDF file.

How to use

static void Main(string[] args)
{
    var html = @"
        <html>
            <title>PDF</title>
            <body>
                <b>PDF Sample - Carlos dos Santos</b>
            </body>
        </html>";

    var htmlToPdf = new HtmlToPDFCore.HtmlToPDF();
    var pdf = htmlToPdf.ReturnPDF(html);

    FileStream fs = new FileStream("teste.pdf",FileMode.CreateNew);
    fs.Write(pdf,0,pdf.Length);
    fs.Close();
}

Environment Tested

Windows Linux Microsoft Azure AppServices using Linux Service Plan

Contributing

Feel free to use and contribute with this project.

About

Convert HTML to PDF

License:MIT License


Languages

Language:C# 88.7%Language:CSS 5.7%Language:HTML 2.9%Language:Shell 1.8%Language:JavaScript 1.0%