웹 캡처 및 변환 도구

ASP.NET을 사용한 고급 스크린 샷 기능

ASP.NET API

기본 스크린 샷 기능뿐만 아니라 GrabzIt ASP.NET API 개발자가 기존 스크린 샷의 상태를 확인하고 GrabzIt이 개발자의 스크린 샷을 찍는 데 사용할 쿠키를 설정할 수 있습니다.

스크린 샷 상태

때때로 응용 프로그램은 스크린 샷의 상태를 확인해야 할 수도 있습니다 (아마 찍었는지 확인하거나 여전히 캐시되어 있는지 확인).

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

ScreenShotStatus status = grabzIt.GetStatus(screenShotId);

if (status.Processing)
{
    // screenshot has not yet been processed
}

if (status.Cached)
{
    // screenshot is still cached by GrabzIt
}

if (status.Expired)
{
    // screenshot is no longer on GrabzIt
    // Perhaps output status message?
    label.Text = status.Message;
}

Cookies

일부 웹 사이트는 쿠키를 통해 기능을 제어합니다. GrabzIt을 사용하면 다음과 같은 방법으로 개발자가 정의한 쿠키를 설정할 수 있습니다.

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

// gets an array of cookies for google.com
GrabzItCookie[] cookies = grabzIt.Cookies("google.com");

# sets a cookie for the google.com domain
grabzIt.SetCookie("MyCookie", "google.com", "Any Value You Like");

# deletes the previously set cookie
grabzIt.DeleteCookie("MyCookie", "google.com");

쿠키 삭제 방법은 동일한 이름과 도메인을 가진 모든 쿠키를 삭제합니다.

다운로드하지 않고 캡처 표시

캡처를 사용하기 전에 웹 서버로 다운로드하는 것이 좋습니다. 웹 서버에 먼저 다운로드하지 않고도 사용자의 브라우저에 모든 유형의 캡처를 표시 할 수 있습니다.

캡처가 완료되면에서 캡처 한 바이트를 보낼 수 있습니다. SaveTo 방법 응답과 함께 올바른 마임 유형.

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

grabzIt.URLToImage("https://www.tesla.com");
GrabzItFile capture = grabzIt.SaveTo();

if (capture != null)
{
    Response.ContentType = "image/jpeg";
    Response.BinaryWrite(capture.Bytes);
}

응답에 캡처를 출력하는 예는 위의 URLToImage 메소드를 사용하지만 모든 변환 메소드와 함께 작동합니다.