Our take
- Activity
- 20
- Community
- 4
- Issues
- 21
- Pull requests
- 21
+0 stars in the last 16 days
- Fewer contributors than 91% of the projects we track
Overview
HtmlRendererCore brings HTML-to-PDF generation to .NET Core applications by combining a partial port of HtmlRenderer with PdfSharpCore. It is aimed at developers who need to create PDF documents from HTML within a C# project rather than use a separate conversion service.
The project is a fit for straightforward PDF generation, but it does not claim complete HTML-rendering coverage. Its maintainers describe broader rendering support as future work.
Key Features
- Generates PDF documents from HTML strings.
- Uses PdfSharpCore to create PDFs.
- Supports specifying a page size, such as A4.
- Allows generated PDFs to be saved to a stream and encoded as Base64.
- Provides a .NET Core-oriented partial port of HtmlRenderer.
Use Cases
- A .NET Core developer needs to generate a basic PDF from HTML in an application.
- A service needs to return a generated PDF as a file or stream.
- An application needs to encode a generated PDF as Base64 for transfer or storage.
Getting Started
Use PdfGenerator.GeneratePdf with the HTML content and a page size:
var pdf = PdfGenerator.GeneratePdf(html, PdfSharpCore.PageSize.A4);
See the repository README for additional usage details. The project uses PdfSharpCore.
Alternatives
- QuestPDF: QuestPDF builds PDFs with a fluent component API rather than converting HTML, so it suits structured documents instead of HTML-based layouts.
| Project | Language | License | Stars | Status |
|---|---|---|---|---|
| HtmlRendererCore | C# | MIT | 34 | Not checked yet |
| QuestPDF | C# | – | 14.2k | Active |
Considerations
- This is a partial port, so it may not support all HTML-rendering behavior available in the original HtmlRenderer.
- The README identifies support for more advanced HTML rendering as future work.
- PDF generation depends on PdfSharpCore; check its documentation and compatibility for your project before adopting this library.
Found this useful?
Share it with someone who would like HtmlRendererCore.