다음 예에서는 아래 DIV의 콘텐츠를 캡처합니다.
이미지가 대상 HTML 요소의 크기와 일치하도록 이미지의 너비와 높이를 -1로 설정합니다. 브라우저 높이를 -1로 설정하면 브라우저 창의 길이도 자동으로 증가하여 대상 HTML 요소가 맞는지 확인합니다. into 브라우저.
아래 예제 코드는 Java를 사용하여 웹 페이지에서 HTML 요소를 이미지로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 이미지 만들기를 시작하려면 자바 라이브러리 다운로드, 당신의 열쇠와 비밀 그리고 데모를 사용하십시오 안에 포함되어 있습니다. 그런 다음 Java 용 API 문서 GrabzIt의 API를 사용할 수있는 모든 방법을 알아보십시오.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.setWidth(-1);
options.setHeight(-1);
options.setBrowserHeight(-1);
options.setFormat(ImageFormat.JPG);
options.setTargetElement("#Article");
grabzIt.URLToImage("http://www.example.com/", options);
grabzIt.SaveTo("images/result.jpg");
아래 예제 코드는 Node.js를 사용하여 웹 페이지에서 HTML 요소를 이미지로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 이미지 만들기를 시작하려면 Node.js 패키지 다운로드, 당신의 열쇠와 비밀 그리고 데모를 사용하십시오 안에 포함되어 있습니다. 그런 다음 Node.js에 대한 API 문서 GrabzIt의 API를 사용할 수있는 모든 방법을 알아보십시오.
var grabzit = require('grabzit');
var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
// The minus ones indicates that image should not be cropped
var options = {"browserHeight":-1, "width":-1, "height":-1, "format":"jpg", "target":"#Article"};
client.url_to_image("http://www.example.com/", options);
client.save_to("images/result.jpg", function (error, id){
if (error != null){
throw error;
}
});
아래 예제 코드는 Perl을 사용하여 웹 페이지에서 HTML 요소를 이미지로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 이미지 만들기를 시작하려면 Perl 라이브러리 다운로드, 당신의 열쇠와 비밀 그리고 데모를 사용하십시오 안에 포함되어 있습니다. 그런 다음 Perl API 문서 GrabzIt의 API를 사용할 수있는 모든 방법을 알아보십시오.
#!/usr/bin/perl
use GrabzItClient;
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItImageOptions->new();
$options->browserHeight(-1);
$options->width(-1);
$options->height(-1);
$options->targetElement("#Article");
$grabzIt->URLToImage("http://www.example.com/", $options);
$grabzIt->SaveTo("images/result.jpg");
아래 예제 코드는 PHP를 사용하여 웹 페이지에서 HTML 요소를 이미지로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 이미지 파일 만들기를 시작하려면 PHP 라이브러리 다운로드, 당신의 열쇠와 비밀 그리고 데모를 사용하십시오 안에 포함되어 있습니다. 그런 다음 PHP 용 API 문서 GrabzIt의 API를 사용할 수있는 모든 방법을 알아보십시오.
include("GrabzItClient.php");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
// The -1 indicates that image should not be cropped
$options = new \GrabzIt\GrabzItImageOptions();
$options->setWidth(-1);
$options->setHeight(-1);
$options->setBrowserHeight(-1);
$options->setFormat("jpg");
$options->setTargetElement("#Article");
$grabzIt->URLToImage("http://www.example.com/", $options);
$grabzIt->SaveTo("images/result.jpg");
아래 예제 코드는 Python을 사용하여 웹 페이지에서 HTML 요소를 이미지로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 이미지 만들기를 시작하려면 파이썬 라이브러리 다운로드, 당신의 열쇠와 비밀 그리고 데모를 사용하십시오 안에 포함되어 있습니다. 그런 다음 파이썬 API 문서 GrabzIt의 API를 사용할 수있는 모든 방법을 알아보십시오.
from GrabzIt import GrabzItClient
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
# The -1 indicates that image should not be cropped
options = GrabzItImageOptions.GrabzItImageOptions()
options.width = 250
options.height = 250
options.browserHeight = -1
options.format = "jpg"
options.targetElement = "#Article"
grabzIt.URLToImage("http://www.example.com/", options)
grabzIt.SaveTo("images/result.jpg")
아래 예제 코드는 REST API를 사용하여 웹 페이지에서 HTML 요소를 이미지로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 그런 다음 REST API에 대한 API 문서 캡처를 사용자 정의 할 수있는 모든 방법을 찾아보십시오.
https://api.grabz.it/services/convert.ashx?key=Sign in to view your Application Key&width=-1&height=-1&bheight=-1&target=%23Article&format=jpg&url=https%3A%2F%2Fwww.example.com%2F
캡처 된 HTML 요소를 변환 할 때 into Word 문서 캡처 된 HTML 요소는 Word 문서 페이지의 왼쪽 상단에 나타납니다.
아래 예제 코드는 REST API를 사용하여 웹 페이지에서 HTML 요소를 Word 문서로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 그런 다음 REST API에 대한 API 문서 캡처를 사용자 정의 할 수있는 모든 방법을 찾아보십시오.
https://api.grabz.it/services/convert.ashx?key=Sign in to view your Application Key&target=%23Article&format=docx&url=https%3A%2F%2Fwww.example.com%2F
캡처 된 HTML 요소를 변환 할 때 기본적으로 into PDF 문서 캡처 된 HTML 요소는 DOCX와 동일한 방식으로 PDF 페이지의 왼쪽 상단에 나타납니다. 그러나 PDF에서는 자동으로 HTML 요소의 크기와 일치하도록 페이지 크기 설정.
아래 예제 코드는 REST API를 사용하여 웹 페이지에서 HTML 요소를 PDF로 캡처하는 것이 얼마나 쉬운 지 보여줍니다. 그런 다음 REST API에 대한 API 문서 캡처를 사용자 정의 할 수있는 모든 방법을 찾아보십시오.
https://api.grabz.it/services/convert.ashx?key=Sign in to view your Application Key&target=%23Article&format=pdf&url=https%3A%2F%2Fwww.example.com%2F