捕獲和轉換Web的工具

ASP.NET的屏幕快照事件ASP.NET API

GrabzIt的ASP.NET API 還支持事件,下面是將處理程序分配給 ScreenShotComplete 屏幕快照調用之前發生的事件。 然後,截圖完成後, grabzIt_ScreenShotComplete 方法被調用。

private GrabzItClient grabzIt = GrabzItClient.Create("Sign in to view your Application Key", "Sign in to view your Application Secret");

protected void btnSubmit_Click(object sender, EventArgs e)
{ 
    grabzIt.ScreenShotComplete += grabzIt_ScreenShotComplete;
    grabzIt.URLToImage("https://www.tesla.com"); 	

    //The below line specifies the GrabzIt.ashx handler inside the GrabzIt.dll
    grabzIt.Save(HttpContext.Current.Request.Url.Scheme + "://" + 
    HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath
    + "GrabzIt.ashx");
}

//The event method saves the screenshot
protected void grabzIt_ScreenShotComplete(object sender, ScreenShotEventArgs result)
{
    GrabzItFile file = grabzIt.GetResult(result.ID);
    file.Save(Server.MapPath("~/results/"+result.Filename));
}

最後配置web.config,以便GrabzIt.ashx point到 處理器 嵌入 抓取DLL。 如果執行不正確, ScreenShotComplete 事件不會被觸發。

記住這一點 回電話 如果您的應用程序位於localhost上將不起作用。

<httpHandlers>
        <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" />
</httpHandlers>