捕獲和轉換Web的工具

使用ASP.NET拍攝移動網站的屏幕截圖

ASP.NET API

GrabzIt ASP.NET API 提供了對網站的移動版本進行屏幕截圖的功能,但是,並非所有網站都具有特殊的移動版本,因此可能無法在所有情況下都起作用。 圖像和PDF屏幕截圖以及提取表格時都可以請求移動屏幕截圖。

為此,您需要使用 BrowserType 枚舉值 MobileBrowser 當創建一個 圖片, PDF or , 如下所示。 然後,這將請求目標網站的移動版本。

為了獲得更真實的手機屏幕截圖,最好將標準的移動瀏覽器寬度傳遞給 BrowserWidth 的財產 ImageOptions 類。 或者,如果要創建PDF,請選擇較小的頁面尺寸。

ImageOptions options = new ImageOptions();
options.Format = ImageFormat.png;
options.BrowserWidth = 320;
options.Width = 256;
options.Height = 256;
options.RequestAs = BrowserType.MobileBrowser;

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
grabzIt.URLToImage("https://www.tesla.com", options);
grabzIt.Save("http://www.mysite.com/Home/Handler");