SimpleHtmlToPdf 2.1.12
See the version list below for details.
dotnet add package SimpleHtmlToPdf --version 2.1.12
NuGet\Install-Package SimpleHtmlToPdf -Version 2.1.12
<PackageReference Include="SimpleHtmlToPdf" Version="2.1.12" />
paket add SimpleHtmlToPdf --version 2.1.12
#r "nuget: SimpleHtmlToPdf, 2.1.12"
// Install SimpleHtmlToPdf as a Cake Addin #addin nuget:?package=SimpleHtmlToPdf&version=2.1.12 // Install SimpleHtmlToPdf as a Cake Tool #tool nuget:?package=SimpleHtmlToPdf&version=2.1.12
Simple HTML to PDF
Simple HTML to PDF is a lightweight NuGet package that provides a simple HTML to PDF converter library for .NET projects. It allows you to easily convert HTML content to PDF documents using the wkhtmltopdf
command-line tool.
Installation
You can install the Simple HTML to PDF package via NuGet Package Manager or by using the .NET CLI.
NuGet Package Manager
Open the NuGet Package Manager in Visual Studio.
Search for "SimpleHtmlToPdf" and select the package.
Click on the "Install" button to install the package into your project.
.NET CLI
Execute the following command in the terminal:
dotnet add package SimpleHtmlToPdf
Usage
To use the Simple HTML to PDF library in your project, follow these steps:
Install the Simple HTML to PDF package (as described in the Installation section).
Add a reference to the library in your project:
using SimpleHtmlToPdf.Interfaces; using SimpleHtmlToPdf.Settings; using SimpleHtmlToPdf.Settings.Enums; using SimpleHtmlToPdf.UnmanagedHandler;
Ask for an instance of the
IConverter
class from the system's IoC:public HomeController(IConverter converter) { ... }
Convert an HTML string to a PDF document:
// Define the HTML-to-PDF request input var doc = new HtmlToPdfDocument() { GlobalSettings = { // Color mode of the output file ColorMode = ColorMode.Color, // Orientation of the output file Orientation = Orientation.Landscape, // Paper size of the output file PaperSize = PaperKind.A4Plus, }, Objects = { new ObjectSettings() { // HTML content to convert HtmlContent = "<html><body>Test</body></html>", // The default encoding used. WebSettings = { DefaultEncoding = "utf-8" }, }, } }; // Convert our HTML document to a PDF document var pdf = Converter.Convert(doc);
Replace
HtmlContent
with the actual HTML content you want to convert.Send the PDF file to the browser:
return File(pdf, "application/pdf", "Test.pdf");
Customize based on your requirements.
Contributing
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
Fork the repository.
Create a new branch:
git checkout -b feature/your-feature-name
Make your changes and commit them:
git commit -m "Add your commit message"
Push your changes to your forked repository:
git push origin feature/your-feature-name
Open a pull request in this repository, and provide a detailed description of your changes.
License
This project is licensed under the Apache 2 License.
Acknowledgments
- The
wkhtmltopdf
tool, which enables HTML to PDF conversion. - The DinkToPDF library, which provided the initial code.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Canister.IoC (>= 5.3.16)
-
net8.0
- Canister.IoC (>= 5.3.16)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.15 | 471 | 11/12/2024 |
2.1.14 | 250 | 11/11/2024 |
2.1.13 | 929 | 11/5/2024 |
2.1.12 | 201 | 11/4/2024 |
2.1.11 | 279 | 10/29/2024 |
2.1.10 | 180 | 10/29/2024 |
2.1.9 | 551 | 10/15/2024 |
2.1.8 | 278 | 10/10/2024 |
2.1.7 | 757 | 8/23/2024 |
2.1.6 | 377 | 8/14/2024 |
2.1.5 | 209 | 8/2/2024 |
2.1.4 | 1,185 | 6/25/2024 |
2.1.3 | 784 | 6/18/2024 |
2.1.2 | 443 | 6/17/2024 |
2.1.1 | 445 | 5/13/2024 |
2.1.0 | 295 | 5/13/2024 |
2.0.48 | 207 | 5/13/2024 |
2.0.47 | 347 | 5/7/2024 |
2.0.46 | 281 | 5/6/2024 |
2.0.45 | 284 | 5/2/2024 |
2.0.44 | 304 | 5/1/2024 |
2.0.43 | 319 | 4/30/2024 |
2.0.42 | 481 | 3/28/2024 |
2.0.41 | 438 | 3/15/2024 |
2.0.40 | 411 | 3/14/2024 |
2.0.39 | 808 | 3/5/2024 |
2.0.38 | 356 | 3/4/2024 |
2.0.37 | 315 | 2/27/2024 |
2.0.36 | 352 | 2/22/2024 |
2.0.35 | 297 | 2/19/2024 |
2.0.34 | 239 | 2/5/2024 |
2.0.33 | 206 | 1/30/2024 |
2.0.32 | 208 | 1/22/2024 |
2.0.31 | 491 | 12/18/2023 |
2.0.30 | 384 | 12/12/2023 |
2.0.29 | 366 | 12/11/2023 |
2.0.28 | 461 | 11/20/2023 |
2.0.27 | 1,179 | 11/17/2023 |
2.0.26 | 362 | 11/16/2023 |
2.0.25 | 246 | 11/7/2023 |
2.0.24 | 826 | 11/6/2023 |
2.0.23 | 439 | 10/31/2023 |
2.0.22 | 425 | 10/30/2023 |
2.0.21 | 590 | 9/20/2023 |
2.0.20 | 417 | 9/19/2023 |
2.0.19 | 424 | 9/18/2023 |
2.0.18 | 722 | 9/12/2023 |
2.0.17 | 654 | 9/6/2023 |
2.0.16 | 452 | 9/5/2023 |
2.0.15 | 492 | 9/4/2023 |
2.0.14 | 511 | 9/1/2023 |
2.0.13 | 477 | 8/31/2023 |
2.0.12 | 502 | 8/30/2023 |
2.0.11 | 511 | 8/29/2023 |
2.0.10 | 838 | 8/9/2023 |
2.0.9 | 617 | 8/8/2023 |
2.0.8 | 850 | 7/13/2023 |
2.0.7 | 463 | 7/13/2023 |
2.0.6 | 422 | 7/11/2023 |
2.0.5 | 389 | 7/8/2023 |
2.0.4 | 492 | 7/8/2023 |
2.0.3 | 467 | 7/8/2023 |
2.0.2 | 525 | 7/8/2023 |
2.0.1 | 476 | 7/8/2023 |
2.0.0 | 1,045 | 12/12/2022 |
1.0.18 | 762 | 10/11/2022 |
1.0.17 | 1,181 | 6/10/2022 |
1.0.13 | 1,069 | 1/11/2022 |
1.0.11 | 746 | 2/24/2021 |
1.0.10 | 686 | 1/7/2021 |
1.0.7 | 752 | 10/30/2020 |
1.0.6 | 915 | 9/13/2020 |
1.0.5 | 824 | 5/4/2020 |
1.0.4 | 790 | 5/4/2020 |
1.0.3 | 764 | 5/4/2020 |
1.0.2 | 950 | 5/4/2020 |