 |
HtmlToImageConvertHtmlStringAsync(String) Method |
Asynchronously converts the specified HTML string to an image in
ImageFormat (PNG by default).
Namespace: SelectPdf.UniversalAssembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntaxpublic Task<byte[]> ConvertHtmlStringAsync(
string htmlString
)
Public Function ConvertHtmlStringAsync (
htmlString As String
) As Task(Of Byte())
Parameters
- htmlString String
- The HTML markup to render.
Return Value
TaskByteA task that completes with the rendered image, encoded in
ImageFormat.
Exceptions| Exception | Condition |
|---|
| HtmlToPdfException | The task faults with this exception when htmlString is null, or the conversion fails. |
Remarks
ExampleSelectPdf.Universal.HtmlToImage converter = new SelectPdf.Universal.HtmlToImage();
byte[] png = await converter.ConvertHtmlStringAsync("<h1>Hello</h1>");Dim converter As New SelectPdf.Universal.HtmlToImage()
Dim png As Byte() = Await converter.ConvertHtmlStringAsync("<h1>Hello</h1>")
See Also