捕获和转换Web的工具

在转换之前如何更改网页?

修改网页

您可以在将任何页面捕获为图像、PDF 或 DOCX 之前更改其 HTML。

为此,您需要使用您正在使用的编程语言中的适当方法来读取 HTML 页面的内容。 完成此操作后,请更改 HTML,其示例如下所示。 然后将地址参数设置为用于读取内容的相同地址参数。 这将确保使用相同的 URL 捕获网页,以便正确呈现任何相关资源。

string html = ""; //populate this variable by the HTML from http://www.example.com/index.html
//alter HTML
html += "<style>body{background-color:red !important;}</style>";
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.Address = "http://www.example.com/index.html";
grabzIt.HTMLToImage(html, options);
grabzIt.SaveTo("result.jpg");
String html = ""; //populate this variable by the HTML from http://www.example.com/index.html
//alter HTML
html += "<style>body{background-color:red !important;}</style>";
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.setAddress("http://www.example.com/index.html");
grabzIt.HTMLToImage(html, options);
grabzIt.SaveTo("result.jpg");
var grabzit = require('grabzit');

var html = ""; //populate this variable by the HTML from http://www.example.com/index.html
//alter HTML
html += "<style>body{background-color:red !important;}</style>";
var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.html_to_image(html,{"address":"http://www.example.com/index.html"});
client.save_to("result.jpg", function (error, id){
    if (error != null){
        throw error;
    }
});
$html = ""; #populate this variable by the HTML from http://www.example.com/index.html			
#alter HTML
html .= "<style>body{background-color:red !important;}</style>";
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItImageOptions->new();
$options->address("http://www.example.com/index.html");
$grabzIt->HTMLToImage($html,$options);
$grabzIt->SaveTo("result.jpg");
$html = ""; //populate this variable by the HTML from http://www.example.com/index.html	
//alter HTML
$html .= "<style>body{background-color:red !important;}</style>";
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItImageOptions();
$options->setAddress("http://www.example.com/index.html");
$grabzIt->HTMLToImage($html, $options);
$grabzIt->SaveTo("result.jpg");
html = "" #populate this variable by the HTML from http://www.example.com/index.html	
#alter HTML
html += "<style>body{background-color:red !important;}</style>"
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItImageOptions.GrabzItImageOptions()
options.address = "http://www.example.com/index.html"
grabzIt.HTMLToImage(html, options)
grabzIt.SaveTo("result.jpg")
html = "" #populate this variable by the HTML from http://www.example.com/index.html
#alter HTML
html += "<style>body{background-color:red !important;}</style>";
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::ImageOptions.new()
options.address = "http://www.example.com/index.html"
grabzIt.html_to_image(html, options)
grabzIt.save_to("result.jpg")