FetchLatestChromeHeadlessShellAsync Method (GdPictureDocumentUtilities)
In This Topic
Download the latest version of chrome headless shell and save it to the specified path, if the latest version is already present it'll return the path of the existing browser path.
See more here.
See more here.
Syntax
'Declaration
<AsyncStateMachineAttribute(GdPicture14.GdPictureDocumentUtilities/d__13)>
Public Shared Function FetchLatestChromeHeadlessShellAsync( _
ByVal As String _
) As Task(Of String)
[AsyncStateMachine(GdPicture14.GdPictureDocumentUtilities/d__13)]
public static Task<string> FetchLatestChromeHeadlessShellAsync(
string
)
public function FetchLatestChromeHeadlessShellAsync(
: String
): Task; static;
AsyncStateMachineAttribute(GdPicture14.GdPictureDocumentUtilities/d__13)
public static function FetchLatestChromeHeadlessShellAsync(
: String
) : Task;
[AsyncStateMachine(GdPicture14.GdPictureDocumentUtilities/d__13)]
public: static Task<string*>* FetchLatestChromeHeadlessShellAsync(
string*
)
[AsyncStateMachine(GdPicture14.GdPictureDocumentUtilities/d__13)]
public:
static Task<String^>^ FetchLatestChromeHeadlessShellAsync(
String^
)
Parameters
- path
- The folder where the executable will be downloaded
Return Value
The full path of the downloaded executable
Example
var latestChromeDownloadPath = await GdPictureDocumentUtilities.FetchLatestChromeHeadlessShellAsync(Environment.CurrentDirectory);
GdPictureDocumentUtilities.SetWebBrowserPath(latestChromeDownloadPath);
using GdPictureDocumentConverter conv = new();
var status = conv.LoadFromHttp(new Uri("https://avepdf.com/"));
if (status != GdPictureStatus.OK)
{
throw new Exception($"Convert from http Failed ! ({status})");
}
status = conv.SaveAsPDF("output.pdf");
if (status != GdPictureStatus.OK)
{
throw new Exception($"Saved from http Failed ! ({status})");
}
Example
See more here.
var latestChromeDownloadPath = await GdPictureDocumentUtilities.FetchLatestChromeHeadlessShellAsync(Environment.CurrentDirectory);
GdPictureDocumentUtilities.SetWebBrowserPath(latestChromeDownloadPath);
using GdPictureDocumentConverter conv = new();
var status = conv.LoadFromHttp(new Uri("https://avepdf.com/"));
if (status != GdPictureStatus.OK)
{
throw new Exception($"Convert from http Failed ! ({status})");
}
status = conv.SaveAsPDF("output.pdf");
if (status != GdPictureStatus.OK)
{
throw new Exception($"Saved from http Failed ! ({status})");
}
See Also