If I was to take a wild guess, because you've not actually explained the error that you're having on the post (which you should), I'd say it's because you're calling an asynchronous method synchronously. You make a call to:
public static async Task PrintToPdfAsync(string path)
{
await browser.PrintToPdfAsync(path);
}
But you don't
await
this method, so this part:
PrintToPdfAsync(path);
Cef.Shutdown();
Will call the method
PrintToPdfAsync
and then
immediately call
Cef.Shutdown();
. You need to await the print method.