捕獲和轉換Web的工具
整頁截圖

使用GrabzIt創建完整的屏幕截圖

截屏時的一個常見要求是捕獲整個網頁,或者換種方式創建與截屏網頁高度和寬度相同的截屏。 右側顯示了完整頁面截圖的比例示例。

可以使用 在線截圖工具 如果選擇全長選項。 通過選擇“全寬”和“全高”選項,“在線屏幕截圖工具”還可以使用瀏覽器的確切大小來創建屏幕截圖。 或者,您可以 int編寫完整的屏幕截圖 into通過使用API​​,如下所述。

使用我們的API的全屏截圖

使用GrabzIt的Screenshot API,將完整的屏幕截圖添加到您的應用程序中。 目前,我們的API支持九種不同的編程語言。 要開始使用所需的語言,只需從下面的選擇中選擇合適的一種即可查看示例代碼和說明。 以下所有示例均創建與網站高度和寬度相同大小的圖像。

下面的代碼演示了使用ASP.NET創建整頁屏幕截圖的簡便性。 要開始捕獲完整的網頁 下載ASP.NET庫, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 ASP.NET的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

ImageOptions options = new ImageOptions();
options.BrowserHeight = -1;
options.Width = -1;
options.Height = -1;

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", 
    "Sign in to view your Application Secret");
grabzIt.URLToImage("https://www.tesla.com", options); 
grabzIt.SaveTo("images/result.jpg");

下面的代碼演示了使用Java創建完整的屏幕截圖是多麼容易。 要開始捕獲完整的網頁 下載Java庫, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 Java的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

ImageOptions options = new ImageOptions();
options.setBrowserHeight(-1);
options.setWidth(-1);
options.setHeight(-1);

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key",
    "Sign in to view your Application Secret");
grabzIt.URLToImage("https://www.tesla.com", options); 
grabzIt.SaveTo("images/result.jpg");

下面的代碼演示了使用JavaScript創建整頁截圖的簡單性。 開始捕獲完整的網頁下載 GrabzIt的JavaScript庫。 然後得到你的 應用程序密鑰和秘密, 添加域 您要使用JavaScript,然後簽出 JavaScript的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@<%= APIVersion.JavaScript %>/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("https://www.tesla.com", 
{"bheight":-1,"width":-1,"height":-1}).Create();
</script>

以下代碼演示了使用Node.js創建完整的屏幕截圖非常容易。 要開始捕獲完整的網頁 下載Node.js程序包, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 Node.js的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

var grabzit = require('grabzit');

var options = {"width":-1, "height":-1, "browserHeight":-1};

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.url_to_image("https://www.tesla.com", options);
client.save_to("images/result.jpg", function (error, id){
    if (error != null){
        throw error;
    }
});

下面的代碼演示了使用Perl創建完整的屏幕截圖是多麼容易。 要開始捕獲完整的網頁 下載Perl庫, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 Perl的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

#!/usr/bin/perl

use GrabzItClient;

$options = GrabzItImageOptions->new();
$options->browserHeight(-1);
$options->width(-1);
$options->height(-1);

$grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$grabzIt->URLToImage("https://www.tesla.com", $options);
$grabzIt->SaveTo("images/result.jpg");

以下代碼演示了使用PHP創建完整的屏幕截圖非常容易。 要開始捕獲完整的網頁 下載PHP庫, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 屏幕快照API文檔,用於PHP 找出使用GrabzIt API的所有方法。

include("GrabzItClient.php");

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

$options = new \GrabzIt\GrabzItImageOptions();
$options->setWidth(-1);
$options->setHeight(-1);
$options->setBrowserHeight(-1);

$grabzIt->URLToImage("https://www.tesla.com", $options); 
$grabzIt->SaveTo("images/result.jpg");

以下代碼演示了使用Python創建整頁截圖的簡單性。 要開始捕獲完整的網頁 下載Python庫, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 Python的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

from GrabzIt import GrabzItClient
from GrabzIt import GrabzItImageOptions

options = GrabzItImageOptions.GrabzItImageOptions()
options.width = -1
options.height = -1
options.browserHeight = -1

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key",
    "Sign in to view your Application Secret")
grabzIt.URLToImage("https://www.tesla.com", options) 
grabzIt.SaveTo("images/result.jpg") 

以下代碼演示了使用我們的REST API創建完整的屏幕截圖非常容易。 還檢查了 RESTful屏幕截圖API文檔 找出所有可用於自定義捕獲的方法。

https://api.grabz.it/services/convert?key=Sign in to view your Application Key&format=jpg&bheight=-1&width=-1&height=-1&url=https%3A%2F%2Fwww.tesla.com

以下代碼演示了使用Ruby創建完整的屏幕截圖是多麼容易。 要開始捕獲完整的網頁 下載Ruby Gem, 拿你的 應用程序密鑰和秘密 進而 使用演示 包含在其中。 然後檢查 Ruby的屏幕快照API文檔 找出使用GrabzIt API的所有方法。

require 'grabzit'

options = GrabzIt::ImageOptions.new()
options.browserHeight = -1
options.width = -1
options.height = -1

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", 
    "Sign in to view your Application Secret")
grabzItClient.url_to_image("https://www.tesla.com", options)	
grabzItClient.save_to("images/result.jpg")