Webをキャプチャして変換するツール

Try GrabzIt's free API to convert HTML to PDF and Convert HTML to ImagesHTML to PDFおよびImage API

In today's world, the ability to convert HTML to PDF and images is becoming increasingly important. If you are a developer or business owner, it is important to have the right tools.

These tools are necessary for tasks such as creating code documentation. They are also useful for converting web pages to PDFs for clients. This article explains how an HTML to PDF and Image API can convert your HTML code into the format you want.

All websites use HTML, or Hypertext Markup Language. Using GrabzIt's free API you can easily convert this HTML into PDF or 画像.

HTMLを変換 GrabzIt uses a web browser instance. This properly renders any resources, referenced within the HTML such as CSS, JavaScript, videos, Flash, SVG or web fonts. Ensuring our converter can accurately transform it into an image or PDF.

When converting HTML, you need to include all CSS and image content in the HTML code or use absolute URLs to link to them. One example of this would be a CSS file referenced in the HTML code, using an absolute URL. Another choice is to use a Data URL, which lets you put resources like images directly in the HTML code.

Check out the demo above to see how easy it is to convert HTML into an image or PDF. GrabzIt's APIs assist developers in creating different types of content effortlessly.

HTML to PDF API

Several popular use cases for converting HTML to PDF exist. One of them is for code documentation. Many developers prefer to have their code in a PDF format for easier sharing and printる。

Another popular use case for converting HTML to PDF is for creating reports or invoices from web pages. This is where a code to PDF API is useful. These APIs allow you to simply input your HTML code and convert it into a PDF document with just a few lines of code.

One of the best PDF API's on the market is GrabzIt. This API offers a simple and straightforward integration into any programming language. With GrabzIt, you can customize the appearance of your PDF, including adding headers and footers. You can also enhance security by protecting the PDF with a password.

Easily enable your app to convert HTML to PDF by using GrabzIt's simple to use API. Accessible in nine different ways. Just choose your required method from below and then follow the relevant instructions.

以下のサンプルコードは、C#を使用してAPIを使用してHTMLをPDFに変換するのがいかに簡単かを示していますが、GrabzItのASP.NETライブラリはあらゆる.NET言語と互換性があります。 PDFの作成を開始するには ASP.NETライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 ASP.NETのAPIドキュメント to learn all the ways you can use GrabzIt's API.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>"); 
grabzIt.SaveTo("documents/result.pdf");

以下のサンプルコードは、HTMLからPDFへのJavaライブラリを使用するのがいかに簡単かを示しています。 PDFの作成を開始するには Javaライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 JavaのAPIドキュメント to learn all the ways you can use GrabzIt's API.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>"); 
grabzIt.SaveTo("documents/result.pdf");

The example code below shows how easy it is to use our convert HTML to PDF using JavaScript. To start creating PDF's download GrabzItのJavaScriptライブラリ。 その後、 鍵と秘密, ドメインを追加 JavaScriptを使用してから、 JavaScriptのAPIドキュメント to learn all the ways you can use GrabzIt's 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").ConvertHTML("<html><body><h1>Hello World!</h1></body></html>",
{"format": "pdf"}).Create();
</script>

以下のサンプルコードは、Node.jsを使用してAPIを使用してHTMLからPDFへの変換を実行することがいかに簡単かを示しています。 PDFの作成を開始するには Node.jsパッケージをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 Node.jsのAPIドキュメント to learn all the ways you can use GrabzIt's API.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>");
client.save_to("documents/result.pdf", function (error, id){
    if (error != null){
        throw error;
    }
});

The example code below shows how easy it is to do HTML to PDF conversion using Perl. To start creating PDF's just Perlライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 PerlのAPIドキュメント to learn all the ways you can use GrabzIt's API.

#!/usr/bin/perl

use GrabzItClient;

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>");
$grabzIt->SaveTo("documents/result.pdf");

The example code below shows how easy it is to use our API to convert HTML to PDF using PHP. To start generating PDF files just PHPライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 PHPのAPIドキュメント to learn all the ways you can use GrabzIt's API.

include("GrabzItClient.php");

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$grabzIt->HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>"); 
$grabzIt->SaveTo("documents/result.pdf");

The example code below shows how easy it is to use our PDF Convertor with Python. To start creating PDF's just Pythonライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 PythonのAPIドキュメント to learn all the ways you can use GrabzIt's API.

from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>") 
grabzIt.SaveTo("documents/result.pdf") 

The example code below shows how easy it is to convert HTML to PDF using our REST API. Then check out the REST APIのAPIドキュメント to learn all the ways you can customize your captures.

curl 
-d key=Sign in to view your Application Key
-d format=pdf 
-d html=%3Chtml%3E%3Cbody%3E%3Ch1%3EHello%20World%21%3C%2Fh1%3E%3C%2Fbody%3E%3C%2Fhtml%3E
https://api.grabz.it/services/convert 

以下のサンプルコードは、APIを使用して、Rubyを使用してHTMLをPDFに変換することがいかに簡単かを示しています。 PDFの作成を開始するには Ruby Gemをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 RubyのAPIドキュメント to learn all the ways you can use GrabzIt's API.

require 'grabzit'

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
grabzItClient.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>")	
grabzItClient.save_to("documents/result.pdf") 	

If you have HTM or HTML files and use PHP, you can generate PDFs from these documents on the server side. Just use the appropriate FileToPDF 方法 代わりに使用している言語に対して。

Having related content split across multiple pages in a PDF document often makes it difficult to read. Which, is why it is often necessary to specify where you want page breaks to appear in a PDF file. To do this you need to specify the special page break HTML syntax as explained in this チュートリアル.

HTML to Image API

In addition to converting HTML to PDF, there may be times when you need to convert HTML to an image format. This could be for creating thumbnails of web pages or for embedding images into emails or documents. In these cases, a convert HTML to image API is the perfect solution.

GrabzIt is one of the top APIs for converting HTML to images. The API offers a simple and efficient integration into any programming language.

HTML to Image lets you convert any webpage or HTML snippet into an image. Of course, you can resize and select the format of the image. Currently the supported file formats are: JPG, PNG, BMP, WEBP and TIFF. Additionally, you can add watermarks and text overlays to the image.

Use one of nine methods below to access the API. Just choose the method you want to use below, and then follow the associated instructions.

以下のサンプルコードは、ASP.NETを使用してHTMLをPNG画像に簡単に変換する方法を示しています。 画像の作成を開始するには ASP.NETライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 ASP.NETのAPIドキュメント to learn all the ways you can use GrabzIt's API.

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

ImageOptions options = new ImageOptions();
options.Format = ImageFormat.png;

grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); 
grabzIt.SaveTo("images/result.jpg");

以下のコード例は、Javaを使用してHTMLをPNG画像に変換するのがいかに簡単かを示しています。 画像の作成を開始するには Javaライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 JavaのAPIドキュメント to learn all the ways you can use GrabzIt's API.

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

ImageOptions options = new ImageOptions();
options.setFormat(ImageFormat.PNG);

grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options); 
grabzIt.SaveTo("images/result.jpg");

以下のサンプルコードは、JavaScriptでHTMLをJPGに変換するのがいかに簡単かを示しています。 画像のダウンロードを作成するには GrabzItのJavaScriptライブラリ。 その後、 鍵と秘密, ドメインを追加 JavaScriptを使用してから、 JavaScriptのAPIドキュメント to learn all the ways you can use GrabzIt's 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").ConvertHTML("<html><body><h1>Hello World!</h1></body></html>").Create();
</script>

以下のサンプルコードは、Node.jsを使用してHTMLを画像に簡単に変換する方法を示しています。 画像の作成を開始するには Node.jsパッケージをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 Node.jsのAPIドキュメント to learn all the ways you can use GrabzIt's API.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.html_to_image("<html><body><h1>Hello World!</h1></body></html>");
client.save_to("images/result.jpg", function (error, id){
    if (error != null){
        throw error;
    }
});

以下のコード例は、Perlを使用してHTMLをJPGに変換するのがいかに簡単かを示しています。 画像の作成を開始するには Perlライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 PerlのAPIドキュメント to learn all the ways you can use GrabzIt's API.

#!/usr/bin/perl

use GrabzItClient;

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$grabzIt->HTMLToImage("<html><body><h1>Hello World!</h1></body></html>");
$grabzIt->SaveTo("images/result.jpg");

以下のサンプルコードは、PHPを使用してHTMLをJPGに簡単に無料で変換する方法を示しています。 画像ファイルの作成を開始するには PHPライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 PHPのAPIドキュメント to learn all the ways you can use GrabzIt's API.

include("GrabzItClient.php");

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$grabzIt->HTMLToImage("<html><body><h1>Hello World!</h1></body></html>"); 
$grabzIt->SaveTo("images/result.jpg");

以下のサンプルコードは、Pythonを使用してHTMLを画像に簡単に変換できることを示しています。 画像の作成を開始するには Pythonライブラリをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 PythonのAPIドキュメント to learn all the ways you can use GrabzIt's API.

from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>") 
grabzIt.SaveTo("images/result.jpg") 

以下のサンプルコードは、REST APIを使用してHTMLをJPG形式に変換するのがいかに簡単かを示しています。 次にチェックしてください REST APIのAPIドキュメント to learn all the ways you can customize your captures.

curl 
-d key=Sign in to view your Application Key
-d format=jpg 
-d html=%3Chtml%3E%3Cbody%3E%3Ch1%3EHello%20World%21%3C%2Fh1%3E%3C%2Fbody%3E%3C%2Fhtml%3E
https://api.grabz.it/services/convert 

以下のサンプルコードは、Rubyを使用してHTMLをJPG形式に変換することがいかに簡単かを示しています。 画像の作成を開始するには Ruby Gemをダウンロードする、取得 鍵と秘密 その後 デモを使用する 内に含まれます。 次に、 RubyのAPIドキュメント to learn all the ways you can use GrabzIt's API.

require 'grabzit'

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
grabzItClient.html_to_image("<html><body><h1>Hello World!</h1></body></html>")	
grabzItClient.save_to("images/result.jpg")