SimpleHtmlToPdf 2.0.42

dotnet add package SimpleHtmlToPdf --version 2.0.42
NuGet\Install-Package SimpleHtmlToPdf -Version 2.0.42
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.0.42" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleHtmlToPdf --version 2.0.42
#r "nuget: SimpleHtmlToPdf, 2.0.42"
#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.0.42

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

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 was computed.  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.0.42 337 3/28/2024
2.0.41 330 3/15/2024
2.0.40 270 3/14/2024
2.0.39 385 3/5/2024
2.0.38 231 3/4/2024
2.0.37 218 2/27/2024
2.0.36 247 2/22/2024
2.0.35 205 2/19/2024
2.0.34 109 2/5/2024
2.0.33 81 1/30/2024
2.0.32 96 1/22/2024
2.0.31 386 12/18/2023
2.0.30 298 12/12/2023
2.0.29 276 12/11/2023
2.0.28 380 11/20/2023
2.0.27 699 11/17/2023
2.0.26 244 11/16/2023
2.0.25 128 11/7/2023
2.0.24 233 11/6/2023
2.0.23 305 10/31/2023
2.0.22 312 10/30/2023
2.0.21 471 9/20/2023
2.0.20 308 9/19/2023
2.0.19 306 9/18/2023
2.0.18 621 9/12/2023
2.0.17 552 9/6/2023
2.0.16 359 9/5/2023
2.0.15 398 9/4/2023
2.0.14 378 9/1/2023
2.0.13 358 8/31/2023
2.0.12 399 8/30/2023
2.0.11 414 8/29/2023
2.0.10 696 8/9/2023
2.0.9 525 8/8/2023
2.0.8 764 7/13/2023
2.0.7 376 7/13/2023
2.0.6 342 7/11/2023
2.0.5 292 7/8/2023
2.0.4 383 7/8/2023
2.0.3 357 7/8/2023
2.0.2 434 7/8/2023
2.0.1 398 7/8/2023
2.0.0 897 12/12/2022
1.0.18 678 10/11/2022
1.0.17 1,094 6/10/2022
1.0.13 971 1/11/2022
1.0.11 659 2/24/2021
1.0.10 601 1/7/2021
1.0.7 673 10/30/2020
1.0.6 816 9/13/2020
1.0.5 723 5/4/2020
1.0.4 693 5/4/2020
1.0.3 683 5/4/2020
1.0.2 757 5/4/2020