כלים ללכידה ולהמרה של האינטרנט

Try GrabzIt's free API to convert HTML to PDF and Convert HTML to ImagesHTML ל- 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.

ממשק API ל- HTML ל- PDF

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 printing.

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.

קוד הדוגמה להלן מראה כמה קל להשתמש בממשק ה- API שלנו כדי להמיר HTML ל- PDF באמצעות C #, אם כי ספריית ASP.NET של GrabzIt תואמת לכל שפת NET. כדי להתחיל ליצור PDFs בלבד הורד את ספריית ASP.NET, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API עבור ASP.NET 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");

קוד הדוגמה שלמטה מראה כמה קל להשתמש בספריית Java שלנו ל- PDF ל- PDF. כדי להתחיל ליצור PDF פשוט הורד את ספריית Java, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API ל- Java 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 ספריית JavaScript של GrabzIt. ואז קבל את שלך מפתח וסוד, הוסף את הדומיין אתה רוצה להשתמש ב- JavaScript ואז לבדוק את תיעוד API ל- JavaScript 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>

קוד הדוגמה להלן מראה כמה קל להשתמש בממשק ה- API שלנו לביצוע המרת HTML ל- PDF באמצעות Node.js. כדי להתחיל ליצור PDFs בלבד הורד את חבילת Node.js, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API עבור Node.js 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 הורד את ספריית פרל, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד 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, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API עבור PHP 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 הורד את ספריית פייתון, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד 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 תיעוד API עבור ממשק ה- REST 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 שלנו כדי להמיר HTML ל- PDF באמצעות Ruby. כדי להתחיל ליצור PDFs בלבד הורד את אבן הרובי, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד 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") 	

Of course you can also convert HTML files to 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 הדרכה.

ממשק API ל- HTML לתמונה

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. A good option for image quality is the PNG format, while if you are worried about file size then JPG is a better choice. 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.

קוד הדוגמה שלהלן מראה כמה קל להמיר HTML לתמונת PNG באמצעות ASP.NET. כדי להתחיל ליצור תמונות סתם הורד את ספריית ASP.NET, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API עבור ASP.NET 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");

קוד הדוגמה שלהלן מראה כמה קל להמיר HTML לתמונת PNG באמצעות Java. כדי להתחיל ליצור תמונות סתם הורד את ספריית Java, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API ל- Java 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");

קוד הדוגמה להלן מראה כמה קל להמיר HTML ל- JPG ב- JavaScript. כדי להתחיל ליצור תמונות להוריד ספריית JavaScript של GrabzIt. ואז קבל את שלך מפתח וסוד, הוסף את הדומיין אתה רוצה להשתמש ב- JavaScript ואז לבדוק את תיעוד API ל- JavaScript 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>

קוד הדוגמה שלהלן מראה כמה קל להמיר HTML לתמונה באמצעות Node.js. כדי להתחיל ליצור תמונות סתם הורד את חבילת Node.js, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API עבור Node.js 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;
    }
});

קוד הדוגמה שלהלן מראה כמה קל להמיר HTML ל- JPG באמצעות 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");

קוד הדוגמה להלן מראה כמה קל להמיר HTML ל- JPG בחינם באמצעות PHP. כדי להתחיל ליצור קבצי תמונות סתם הורד את ספריית PHP, קבל את שלך מפתח וסוד ולאחר מכן השתמש בהדגמה הכלול בתוך. ואז לבדוק את תיעוד API עבור PHP 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");

קוד הדוגמה שלהלן מראה כמה קל להמיר HTML לתמונה באמצעות 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") 

קוד הדוגמה להלן מראה כמה קל להמיר HTML לפורמט JPG באמצעות ממשק ה- REST שלנו. ואז לבדוק את תיעוד API עבור ממשק ה- REST 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 

הקוד לדוגמה להלן מראה כמה קל להמיר HTML לפורמט JPG באמצעות 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")