我已经下载了 Minimalexample.Offscreen 的示例。这是我用于屏幕截图的代码,但我没有得到完整的页面。图像被裁剪(仅拍摄可见页面截图)。
// c# code
var scriptTask = browser.EvaluateScriptAsync("document.getElementById('lst-ib').value = 'CefSharp Was Here!'");
scriptTask.ContinueWith(t =>
{
Thread.Sleep(500);
var task = browser.ScreenshotAsync();
task.ContinueWith(x =>
{
var screenshotPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "CefSharp screenshot.png");
Console.WriteLine();
Console.WriteLine("Screenshot ready. Saving to {0}", screenshotPath);
task.Result.Save(screenshotPath);
task.Result.Dispose();
Console.WriteLine("Screenshot saved. Launching your default image viewer...");
Process.Start(screenshotPath);
Console.WriteLine("Image viewer launched. Press any key to exit.");
}, TaskScheduler.Default);
}).Wait();
如何使用 CefSharp offscreen 或 Cefsharp winforms 获得完整的长页面截图?