HtmlToPdfMaker 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HtmlToPdfMaker --version 2.0.0                
NuGet\Install-Package HtmlToPdfMaker -Version 2.0.0                
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="HtmlToPdfMaker" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HtmlToPdfMaker --version 2.0.0                
#r "nuget: HtmlToPdfMaker, 2.0.0"                
#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 HtmlToPdfMaker as a Cake Addin
#addin nuget:?package=HtmlToPdfMaker&version=2.0.0

// Install HtmlToPdfMaker as a Cake Tool
#tool nuget:?package=HtmlToPdfMaker&version=2.0.0                

<a name='assembly'></a>

HtmlToPdfMaker

Contents

<a name='T-HtmlToPdfMaker-Convert'></a>

Convert type

Namespace

HtmlToPdfMaker

Summary

Class to convert html to Pdf

Example

Usage:

 [TestMethod()]
 public void ToPdfTest()
 {
     List&lt;ContentSet&gt; contentSets = [];
     contentSets.Add(SetContents("&lt;body&gt;&lt;h3&gt;Спокойной ночи&lt;/h3&gt;&lt;p&gt;शुभ रात्रि&lt;/p&gt;&lt;p&gt;Português para principiantes&lt;/p&gt;&lt;hr /&gt;&lt;p&gt;আমি &lt;/p&gt;&lt;/body&gt;", "&lt;body&gt;&lt;div&gt;&lt;b&gt;Спокойной ночи&lt;/b&gt;&lt;/div&gt;&lt;/body&gt;", "Test Page"));
     contentSets.Add(SetContents("&lt;body&gt;&lt;div&gt;&lt;h1&gt;Palash J Karmaker&lt;/h1&gt;&lt;/div&gt;&lt;/body&gt;", "&lt;body&gt;&lt;h3&gt;&lt;u&gt;Header1&lt;/u&gt;&lt;/h3&gt;", "My page"));
     using Convert cvt = new(contentSets);
     var data = cvt.ToPdfAsync(CancellationToken.None).Result;
     File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + "\\Pdf\\test2.pdf", data);
     Assert.IsTrue(data.Length &gt; 0);
     static ContentSet SetContents(string bodyHtml, string headerHtml, string footerHtml)
     {
         var header = Content.CreateDefaultStyledHeader(headerHtml);
         var footer = Content.CreateDefaultStyledFooter(footerHtml);
         var body = Content.CreateDefaultStyledBody(bodyHtml);
         return new(body, header, footer);
     }
 }
See Also

<a name='M-HtmlToPdfMaker-Convert-#ctor-System-Collections-Generic-IReadOnlyList{HtmlToPdfMaker-ContentSet},System-String,DinkToPdf-Orientation,DinkToPdf-PaperKind-'></a>

#ctor() constructor

Summary

Class to convert html to Pdf

Parameters

This constructor has no parameters.

Example

Usage:

 [TestMethod()]
 public void ToPdfTest()
 {
     List&lt;ContentSet&gt; contentSets = [];
     contentSets.Add(SetContents("&lt;body&gt;&lt;h3&gt;Спокойной ночи&lt;/h3&gt;&lt;p&gt;शुभ रात्रि&lt;/p&gt;&lt;p&gt;Português para principiantes&lt;/p&gt;&lt;hr /&gt;&lt;p&gt;আমি &lt;/p&gt;&lt;/body&gt;", "&lt;body&gt;&lt;div&gt;&lt;b&gt;Спокойной ночи&lt;/b&gt;&lt;/div&gt;&lt;/body&gt;", "Test Page"));
     contentSets.Add(SetContents("&lt;body&gt;&lt;div&gt;&lt;h1&gt;Palash J Karmaker&lt;/h1&gt;&lt;/div&gt;&lt;/body&gt;", "&lt;body&gt;&lt;h3&gt;&lt;u&gt;Header1&lt;/u&gt;&lt;/h3&gt;", "My page"));
     using Convert cvt = new(contentSets);
     var data = cvt.ToPdfAsync(CancellationToken.None).Result;
     File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + "\\Pdf\\test2.pdf", data);
     Assert.IsTrue(data.Length &gt; 0);
     static ContentSet SetContents(string bodyHtml, string headerHtml, string footerHtml)
     {
         var header = Content.CreateDefaultStyledHeader(headerHtml);
         var footer = Content.CreateDefaultStyledFooter(footerHtml);
         var body = Content.CreateDefaultStyledBody(bodyHtml);
         return new(body, header, footer);
     }
 }
See Also

<a name='F-HtmlToPdfMaker-Convert-tempFolder'></a>

tempFolder constants

Summary

The tempFolder

<a name='M-HtmlToPdfMaker-Convert-GeneratePdf-System-Collections-Generic-List{DinkToPdf-ObjectSettings}-'></a>

GeneratePdf(objSettings) method

Summary

Generates the PDF.

Returns
Parameters
Name Type Description
objSettings System.Collections.Generic.List{DinkToPdf.ObjectSettings} The object settings.

<a name='M-HtmlToPdfMaker-Convert-ReleaseResources'></a>

ReleaseResources() method

Summary

Releases the resources.

Parameters

This method has no parameters.

<a name='M-HtmlToPdfMaker-Convert-ToPdfAsync-System-Threading-CancellationToken-'></a>

ToPdfAsync(token) method

Summary

Converts to pdf.

Returns
Parameters
Name Type Description
token System.Threading.CancellationToken The token.
Product Compatible and additional computed target framework versions.
.NET 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.0.4 84 8/6/2024
2.0.3 74 8/5/2024
2.0.2 75 8/4/2024
2.0.1 65 8/2/2024
2.0.0 109 7/4/2024
1.0.0 94 7/3/2024