HtmlToPdfMaker 2.0.4
dotnet add package HtmlToPdfMaker --version 2.0.4
NuGet\Install-Package HtmlToPdfMaker -Version 2.0.4
<PackageReference Include="HtmlToPdfMaker" Version="2.0.4" />
paket add HtmlToPdfMaker --version 2.0.4
#r "nuget: HtmlToPdfMaker, 2.0.4"
// Install HtmlToPdfMaker as a Cake Addin #addin nuget:?package=HtmlToPdfMaker&version=2.0.4 // Install HtmlToPdfMaker as a Cake Tool #tool nuget:?package=HtmlToPdfMaker&version=2.0.4
<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<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>Palash J Karmaker</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);
}
}
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<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>Palash J Karmaker</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);
}
}
See Also
<a name='F-HtmlToPdfMaker-Convert-handler'></a>
handler constants
Summary
The http client handler
<a name='F-HtmlToPdfMaker-Convert-tempFolder'></a>
tempFolder constants
Summary
The tempFolder
<a name='M-HtmlToPdfMaker-Convert-GeneratePdf-System-Collections-Generic-IEnumerable{DinkToPdf-ObjectSettings}-'></a>
GeneratePdf(objSettings) method
Summary
Generates the PDF.
Returns
Parameters
Name | Type | Description |
---|---|---|
objSettings | System.Collections.Generic.IEnumerable{DinkToPdf.ObjectSettings} | The object settings. |
<a name='M-HtmlToPdfMaker-Convert-HttpImagePattern'></a>
HttpImagePattern() method
Parameters
This method has no parameters.
Remarks
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>
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. |
<a name='T-System-Text-RegularExpressions-Generated-HttpImagePattern_0'></a>
HttpImagePattern_0 type
Namespace
System.Text.RegularExpressions.Generated
Summary
Custom Regex-derived type for the HttpImagePattern method.
<a name='M-System-Text-RegularExpressions-Generated-HttpImagePattern_0-#ctor'></a>
#ctor() constructor
Summary
Initializes the instance.
Parameters
This constructor has no parameters.
<a name='F-System-Text-RegularExpressions-Generated-HttpImagePattern_0-Instance'></a>
Instance constants
Summary
Cached, thread-safe singleton instance.
<a name='T-System-Text-RegularExpressions-Generated-HttpImagePattern_0-RunnerFactory-Runner'></a>
Runner type
Namespace
System.Text.RegularExpressions.Generated.HttpImagePattern_0.RunnerFactory
Summary
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>
Scan(inputSpan) method
Summary
Scan the inputSpan
starting from base.runtextstart for the next match.
Parameters
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>
TryFindNextPossibleStartingPosition(inputSpan) method
Summary
Search inputSpan
starting from base.runtextpos for the next location a match could possibly start.
Returns
true if a possible match was found; false if no more matches are possible.
Parameters
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>
TryMatchAtCurrentPosition(inputSpan) method
Summary
Determine whether inputSpan
at base.runtextpos is a match for the regular expression.
Returns
true if the regular expression matches at the current position; otherwise, false.
Parameters
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>
RunnerFactory type
Namespace
System.Text.RegularExpressions.Generated.HttpImagePattern_0
Summary
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>
CreateInstance() method
Summary
Creates an instance of a RegexRunner used by methods on Regex.
Parameters
This method has no parameters.
<a name='T-System-Text-RegularExpressions-Generated-Utilities'></a>
Utilities type
Namespace
System.Text.RegularExpressions.Generated
Summary
Helper methods used by generated Regex-derived implementations.
<a name='F-System-Text-RegularExpressions-Generated-Utilities-s_defaultTimeout'></a>
s_defaultTimeout constants
Summary
Default timeout value set in AppContext, or InfiniteMatchTimeout if none was set.
<a name='F-System-Text-RegularExpressions-Generated-Utilities-s_hasTimeout'></a>
s_hasTimeout constants
Summary
Whether s_defaultTimeout is non-infinite.
Product | Versions 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. |
-
net8.0
- HtmlToPdfConverter.Core (>= 2.0.0)
- ImageConverter (>= 1.0.0)
- System.Net.Http (>= 4.3.4)
- Ulid (>= 1.3.4)
- Utility.Disposable (>= 1.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.