웹 캡처 및 변환 도구

Java를 사용한 고급 스크린 샷 기능

자바 API

기본 스크린 샷 기능 외에도 GrabzIt은 Java API입니다 기존 스크린 샷의 상태를 확인하고 GrabzIt이 캡처를 만들 때 사용할 쿠키를 사용자 정의 할 수 있습니다.

스크린 샷 상태

경우에 따라 앱에서 스크린 샷 상태를 확인해야 할 수도 있습니다 (아마 찍었는지 또는 여전히 캐시되어 있는지 확인).

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

Status status = grabzIt.GetStatus(screenShotId);

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

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

if (status.isExpired())
{
    // screenshot is no longer on GrabzIt
    // Perhaps output status message?
}

Cookies

종종 웹 사이트는 쿠키를 사용하여 사용자의 판단 여부와 같은 기능을 제어합니다. 로그인. 아래 쿠키 방법을 사용하여 사용자 정의 쿠키를 설정할 수 있습니다.

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
Cookie[] 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");

위의 쿠키 삭제 방법은 GrabzIt에 저장된 모든 쿠키를 동일한 이름과 도메인으로 삭제합니다.

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

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

캡처가 완료되면에서 캡처 한 바이트를 보낼 수 있습니다. 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)
{ 
    String mimeType = "image/jpeg";
    capture.getBytes();
}

위의 예에서는 캡처 바이트와 MIME 유형을 가져 오지만 응답으로 리턴되는 방법은 사용중인 프레임 워크에 따라 다릅니다.