Click or drag to resize
Pdf Library for .NET

HtmlToImageConvertUrlAsync(String) Method

Asynchronously converts the web page at the specified url to an image in ImageFormat (PNG by default).

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public Task<byte[]> ConvertUrlAsync(
	string url
)

Parameters

url  String
The absolute url of the web page to render.

Return Value

TaskByte
A task that completes with the rendered image, encoded in ImageFormat.
Exceptions
ExceptionCondition
HtmlToPdfExceptionThe task faults with this exception when url is null or empty, or the conversion fails.
Remarks
The conversion produces the same image as ConvertUrl(String). While the page loads and renders, no thread is held waiting for it.
Example
SelectPdf.Universal.HtmlToImage converter = new SelectPdf.Universal.HtmlToImage();
byte[] png = await converter.ConvertUrlAsync("https://selectpdf.com");
See Also