![]() |
VOOZH | about |
dotnet add package HtmlToPdfMaker --version 2.0.7
NuGet\Install-Package HtmlToPdfMaker -Version 2.0.7
<PackageReference Include="HtmlToPdfMaker" Version="2.0.7" />
<PackageVersion Include="HtmlToPdfMaker" Version="2.0.7" />Directory.Packages.props
<PackageReference Include="HtmlToPdfMaker" />Project file
paket add HtmlToPdfMaker --version 2.0.7
#r "nuget: HtmlToPdfMaker, 2.0.7"
#:package HtmlToPdfMaker@2.0.7
#addin nuget:?package=HtmlToPdfMaker&version=2.0.7Install as a Cake Addin
#tool nuget:?package=HtmlToPdfMaker&version=2.0.7Install as a Cake Tool
<a name='assembly'></a>
<a name='T-HtmlToPdfMaker-Convert'></a>
typeHtmlToPdfMaker
Class to convert html to Pdf
Usage:
[TestMethod()]
public void ToPdfTest()
{
List<ContentSet> contentSets = [];
contentSets.Add(SetContents("<body><h3>Спокойной ночи</h3><p>शुभ रात्रि</p><p>Português para principiantes</p><hr /><p>আমি </p></body>", "<body><div><b>Спокойной ночи</b></div></body>", "Test Page"));
contentSets.Add(SetContents("<body><div><h1>Tech J Mage</h1></div></body>", "<body><h3><u>Header1</u></h3>", "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 > 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);
}
}
<a name='M-HtmlToPdfMaker-Convert-#ctor-System-Collections-Generic-IReadOnlyList{HtmlToPdfMaker-ContentSet},System-String,DinkToPdf-Orientation,DinkToPdf-PaperKind-'></a>
constructorClass to convert html to Pdf
This constructor has no parameters.
Usage:
[TestMethod()]
public void ToPdfTest()
{
List<ContentSet> contentSets = [];
contentSets.Add(SetContents("<body><h3>Спокойной ночи</h3><p>शुभ रात्रि</p><p>Português para principiantes</p><hr /><p>আমি </p></body>", "<body><div><b>Спокойной ночи</b></div></body>", "Test Page"));
contentSets.Add(SetContents("<body><div><h1>Tech J Mage</h1></div></body>", "<body><h3><u>Header1</u></h3>", "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 > 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);
}
}
<a name='F-HtmlToPdfMaker-Convert-handler'></a>
constantsThe http client handler
<a name='F-HtmlToPdfMaker-Convert-tempFolder'></a>
constantsThe tempFolder
<a name='M-HtmlToPdfMaker-Convert-GeneratePdf-System-Collections-Generic-IEnumerable{DinkToPdf-ObjectSettings}-'></a>
methodGenerates the PDF.
| Name | Type | Description |
|---|---|---|
| objSettings | System.Collections.Generic.IEnumerable{DinkToPdf.ObjectSettings} | The object settings. |
<a name='M-HtmlToPdfMaker-Convert-HttpImagePattern'></a>
methodThis method has no parameters.
Pattern:
http(s)?:\\/\\/[\\w\\.\\/\\:\\-]+\\.(?<ext>(png)|(webp))
Options:
RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture
Explanation:
○ Match a character in the set [Hh].
<a name='M-HtmlToPdfMaker-Convert-ReleaseResources'></a>
methodReleases the resources.
This method has no parameters.
<a name='M-HtmlToPdfMaker-Convert-ToPdfAsync-ImageMagick-MagickFormat,System-Int32,System-Threading-CancellationToken-'></a>
methodConverts to pdf.
| Name | Type | Description |
|---|---|---|
| imageFormat | ImageMagick.MagickFormat | |
| imageQuality | System.Int32 | |
| token | System.Threading.CancellationToken | The token. |
<a name='T-System-Text-RegularExpressions-Generated-HttpImagePattern_0'></a>
typeSystem.Text.RegularExpressions.Generated
Custom Regex-derived type for the HttpImagePattern method.
<a name='M-System-Text-RegularExpressions-Generated-HttpImagePattern_0-#ctor'></a>
constructorInitializes the instance.
This constructor has no parameters.
<a name='F-System-Text-RegularExpressions-Generated-HttpImagePattern_0-Instance'></a>
constantsCached, thread-safe singleton instance.
<a name='T-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory-Runner'></a>
typeSystem.Text.RegularExpressions.Generated.HttpImagePattern_0.RunnerFactory
Provides the runner that contains the custom logic implementing the specified regular expression.
<a name='M-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory-Runner-Scan-System-ReadOnlySpan{System-Char}-'></a>
methodScan the inputSpan starting from base.runtextstart for the next match.
| Name | Type | Description |
|---|---|---|
| inputSpan | System.ReadOnlySpan{System.Char} | The text being scanned by the regular expression. |
<a name='M-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory-Runner-TryFindNextPossibleStartingPosition-System-ReadOnlySpan{System-Char}-'></a>
methodSearch inputSpan starting from base.runtextpos for the next location a match could possibly start.
true if a possible match was found; false if no more matches are possible.
| Name | Type | Description |
|---|---|---|
| inputSpan | System.ReadOnlySpan{System.Char} | The text being scanned by the regular expression. |
<a name='M-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory-Runner-TryMatchAtCurrentPosition-System-ReadOnlySpan{System-Char}-'></a>
methodDetermine whether inputSpan at base.runtextpos is a match for the regular expression.
true if the regular expression matches at the current position; otherwise, false.
| Name | Type | Description |
|---|---|---|
| inputSpan | System.ReadOnlySpan{System.Char} | The text being scanned by the regular expression. |
<a name='T-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory'></a>
typeSystem.Text.RegularExpressions.Generated.HttpImagePattern_0
Provides a factory for creating RegexRunner instances to be used by methods on Regex.
<a name='M-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory-CreateInstance'></a>
methodCreates an instance of a RegexRunner used by methods on Regex.
This method has no parameters.
<a name='T-System-Text-RegularExpressions-Generated-Utilities'></a>
typeSystem.Text.RegularExpressions.Generated
Helper methods used by generated Regex-derived implementations.
<a name='F-System-Text-RegularExpressions-Generated-Utilities-s_defaultTimeout'></a>
constantsDefault timeout value set in AppContext, or InfiniteMatchTimeout if none was set.
<a name='F-System-Text-RegularExpressions-Generated-Utilities-s_hasTimeout'></a>
constantsWhether s_defaultTimeout is non-infinite.
<a name='F-System-Text-RegularExpressions-Generated-Utilities-s_indexOfString_http_OrdinalIgnoreCase'></a>
constantsSupports searching for the string "http".
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.