웹 캡처 및 변환 도구

Node.js로 웹 사이트 스크린 샷 찍기

Node.js API
또한 진단 패널 코드 디버깅에 도움을 줄 수 있습니다!

웹 사이트 스크린 샷 등을 넣는 가장 좋은 방법 into Node.js 애플리케이션은 다음 단계에 따라 수행됩니다.

  1. 너의 자유를 얻으 십시요 응용 프로그램 키와 비밀.
  2. 무료 다운로드 Node.js 라이브러리 시도해보십시오 데모 신청.
  3. 아래의 개요를 읽고 GrabzIt의 API 작동 방식에 대한 기본 사항을 알아보십시오.

이 도서관은 서버 측만. 클라이언트 측 JavaScript로 캡처를 처리하려면 클라이언트 측 JavaScript API 대신.

Node.js API 개요

API를 사용하려면 먼저 고객 객체, 전달 응용 프로그램 키 및 응용 프로그램 비밀 GrabzIt 계정에서 생성자로.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

그런 다음 중 하나를 사용하십시오 영상, PDF, 생기 or 테이블 캡처 방법 URL or HTML 변환.

// To take a image screenshot
client.url_to_image("https://www.tesla.com"); 	
// Or to take a PDF screenshot
client.url_to_pdf("https://www.tesla.com");
// Or to convert online videos into animated GIF's
client.url_to_animation("http://www.example.com/video.avi");
// Or to capture table(s)
client.url_to_table("https://www.tesla.com");
// To convert HTML into a image
client.html_to_image("<html><body><h1>Hello World!</h1></body></html>"); 	
// Or convert HTML into a PDF document
client.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>");
// Or convert HTML into a CSV, XLSX or JSON document
client.html_to_table("<html><body><table><tr><th>Name</th><th>Age</th></tr>
    <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr>
    </table></body></html>");
// To convert HTML file into a image
client.file_to_image("example.html"); 	
// Or convert HTML file into a PDF document
client.file_to_pdf("example.html");
// Or convert HTML file into a CSV, XLSX or JSON document
client.file_to_table("tables.html");

다음 캡처는 saved, 이렇게하려면 다음 중 하나를 사용해야합니다 save or save_to 이 메소드는 발생한 오류를 처리하기 위해 함수를 전달합니다. 그만큼 save 아래의 메소드 호출에는 매니저 그 처리합니다 콜백 GrabzIt에서 save 스크린 샷 또는 캡처

client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
}); 	
항상 save_to 에 방법 로컬 호스트

다른 옵션은 동시성 save_to 스크린 샷이 생성되는 동안 응용 프로그램이 대기하도록 강제하는 방법입니다. save 방법을 사용할 수 없습니다.

스크린 샷이 생성되면 자동으로 save제공된 파일 경로로 d. Node.js 라이브러리는 제대로 작동하려면 서버 기능이 필요하므로 서버 측에서만 작동합니다.

client.save_to("images/result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
}); 	

추가 옵션

이것은 GrabzIt의 Node.js API에 대한 개요 일뿐입니다. 스크린 샷, 애니메이션 GIF 또는 HTML을 포함하여 변환 할 때 더 많은 옵션이 있습니다. 브라우저 높이, 브라우저 너비, 스크린 샷 높이, 스크린 샷 너비, 스크린 샷 생성 지연 및 스크린 샷의 이미지 형식 구성 이러한 모든 옵션과 웹 변환 기능 into PDF, CSV 또는 애니메이션 GIF는 고객 선적 서류 비치.