SimpleHtmlToPdf 2.1.15

dotnet add package SimpleHtmlToPdf --version 2.1.15                
NuGet\Install-Package SimpleHtmlToPdf -Version 2.1.15                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleHtmlToPdf" Version="2.1.15" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleHtmlToPdf --version 2.1.15                
#r "nuget: SimpleHtmlToPdf, 2.1.15"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SimpleHtmlToPdf as a Cake Addin
#addin nuget:?package=SimpleHtmlToPdf&version=2.1.15

// Install SimpleHtmlToPdf as a Cake Tool
#tool nuget:?package=SimpleHtmlToPdf&version=2.1.15                

Simple HTML to PDF

.NET Publish

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

  1. Open the NuGet Package Manager in Visual Studio.

  2. Search for "SimpleHtmlToPdf" and select the package.

  3. 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:

  1. Install the Simple HTML to PDF package (as described in the Installation section).

  2. Add a reference to the library in your project:

     using SimpleHtmlToPdf.Interfaces;
     using SimpleHtmlToPdf.Settings;
     using SimpleHtmlToPdf.Settings.Enums;
     using SimpleHtmlToPdf.UnmanagedHandler;
    
  3. Ask for an instance of the IConverter class from the system's IoC:

    public HomeController(IConverter converter) { ... }
    
  4. 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.

  5. 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:

  1. Fork the repository.

  2. Create a new branch:

    git checkout -b feature/your-feature-name
    
  3. Make your changes and commit them:

    git commit -m "Add your commit message"
    
  4. Push your changes to your forked repository:

    git push origin feature/your-feature-name
    
  5. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 258 11/12/2024
2.1.14 222 11/11/2024
2.1.13 901 11/5/2024
2.1.12 173 11/4/2024
2.1.11 251 10/29/2024
2.1.10 165 10/29/2024
2.1.9 536 10/15/2024
2.1.8 276 10/10/2024
2.1.7 755 8/23/2024
2.1.6 375 8/14/2024
2.1.5 207 8/2/2024
2.1.4 1,183 6/25/2024
2.1.3 782 6/18/2024
2.1.2 441 6/17/2024
2.1.1 441 5/13/2024
2.1.0 293 5/13/2024
2.0.48 205 5/13/2024
2.0.47 345 5/7/2024
2.0.46 279 5/6/2024
2.0.45 282 5/2/2024
2.0.44 302 5/1/2024
2.0.43 317 4/30/2024
2.0.42 479 3/28/2024
2.0.41 436 3/15/2024
2.0.40 409 3/14/2024
2.0.39 778 3/5/2024
2.0.38 354 3/4/2024
2.0.37 313 2/27/2024
2.0.36 350 2/22/2024
2.0.35 295 2/19/2024
2.0.34 237 2/5/2024
2.0.33 194 1/30/2024
2.0.32 206 1/22/2024
2.0.31 489 12/18/2023
2.0.30 382 12/12/2023
2.0.29 354 12/11/2023
2.0.28 459 11/20/2023
2.0.27 1,147 11/17/2023
2.0.26 360 11/16/2023
2.0.25 244 11/7/2023
2.0.24 824 11/6/2023
2.0.23 437 10/31/2023
2.0.22 423 10/30/2023
2.0.21 588 9/20/2023
2.0.20 415 9/19/2023
2.0.19 422 9/18/2023
2.0.18 720 9/12/2023
2.0.17 652 9/6/2023
2.0.16 450 9/5/2023
2.0.15 490 9/4/2023
2.0.14 509 9/1/2023
2.0.13 475 8/31/2023
2.0.12 500 8/30/2023
2.0.11 509 8/29/2023
2.0.10 836 8/9/2023
2.0.9 615 8/8/2023
2.0.8 848 7/13/2023
2.0.7 461 7/13/2023
2.0.6 420 7/11/2023
2.0.5 387 7/8/2023
2.0.4 490 7/8/2023
2.0.3 465 7/8/2023
2.0.2 523 7/8/2023
2.0.1 474 7/8/2023
2.0.0 1,043 12/12/2022
1.0.18 760 10/11/2022
1.0.17 1,179 6/10/2022
1.0.13 1,067 1/11/2022
1.0.11 744 2/24/2021
1.0.10 684 1/7/2021
1.0.7 750 10/30/2020
1.0.6 913 9/13/2020
1.0.5 822 5/4/2020
1.0.4 788 5/4/2020
1.0.3 762 5/4/2020
1.0.2 948 5/4/2020