.NET Core (dotnetcore) is all the rage now and it truly is the future of Microsoft’s .NET Framework. It is cross-platform, lightweight, and wicked fast. Api2Pdf’s web portal is built on .NET Core. So we love it. However, libraries that work with PDF manipulation have been slow to roll out .NET Core compatible versions. No worries, Api2Pdf’s client works just fine, allowing you to convert HTML to PDF in .NET Core without any issue at all.
Api2Pdf is a REST API that lets you generate PDFs at massive scale. It supports wkhtmltopdf, Headless Chrome, and LibreOffice.
Convert HTML to PDF with .NET Core and C#
You will want to install the Api2Pdf .NET Core client library. Click here to view it on Github. If you already your dotnet CLI open, you can install the package with the command:
dotnet add package api2pdf
Acquire an API key on portal.api2pdf.com. It only takes a minute.
Now in your code, initialize the client library with your API key.
var a2pClient = new Api2Pdf("YOUR-API-KEY");
Once you initialize the client, you can make calls like so:
var apiResponse = a2pClient.HeadlessChrome.FromHtml("<p>Hello, World</p>");
That’s all there is to it. View the documentation to see what other methods are available. In addition to converting HTML to PDF, Api2Pdf supports URL to PDF (webpage to PDF), Word to PDF, Excel to PDF, Powerpoint to PDF (all using LibreOffice), and merging PDFs together. Api2Pdf also provides support for ZXING (Zebra Crossing) for the purposes of generating barcodes and QR codes.Tags: .net core zxing, c# barcode generation, c# qr code generation, c# zxing, doc to pdf c#, docx to pdf c#, excel to pdf .net core, excel to pdf c#, headless chrome .net core, headless chrome c#, headless chrome lambda, html to pdf .net core, html to pdf api, html to pdf api c#, html to pdf api dotnet, html to pdf aws lambda, html to pdf c#, html to pdf dotnetcore, libreoffice .net core, libreoffice c#, merge pdf api c#, merge pdfs .net core, merge pdfs c#, powerpoint to pdf .net core, ppt to pdf c#, pptx to pdf c#, url to pdf .net core, url to pdf c#, webpage to pdf api, webpage to pdf c#, wkhtmltopdf .net core, wkhtmltopdf c#, wkhtmltopdf lambda, word to pdf .net core, word to pdf c#, xls to pdf c#, xlsx to pdf c#