
VeryPDF Web to PDF Converter Cloud API is a cloud service provided by VeryPDF. Developers can use the cloud API to enable the function of converting HTML webpage to PDF in their applications. The following words will tell you how to use the cloud API.
| 1. Access via Email | 2. Use API to convert HTML to PDF | ||
|---|---|---|---|
| 3. Use API to Convert HTML to image | 4. Demonstration PHP code | ||
You no longer need a separate account or API Key to use VeryPDF cloud services. You can directly use your email address for authentication. Our system will automatically detect whether your email is linked to a paid subscription. Emails with a paid subscription will have full access to all API features, while emails without a subscription will generate outputs with a demo watermark.
You may also follow the guide to register a VeryPDF cloud service account if you wish to review the previous registration steps or learn more about account management.
The following demonstration URL shows the basic options to convert HTML to PDF by VeryPDF Web to PDF Converter Cloud API.
http://online.verypdf.com/app/onlineapi/?apikey=XXXXXXXXX&inputfile=http://www.verypdf.com&type=htmltopdfsdk
In the URL, options are separated by character "&", and the basic options are:
API options for converting HTML to image are demonstrated in the following example URL.
http://online.verypdf.com/app/onlineapi/?apikey=XXXXXXXX&inputfile=http://www.verypdf.com&type=htmltoimagesdk&outputfiletype=jpg
In the URL, options "apikey" and "inputfile" are as same as those in conversion from HTML to PDF. To call the API to convert HTML to image, the option "type" should be assigned to "htmltoimagesdk", and the output image format is given by "outputfiletype=jpg". The API supports two image formats, PNG and JPG.
The following is a sample PHP code demonstrating how to use the VeryPDF Web to PDF Converter Cloud API. You can directly use your registered email address for authentication instead of an API key. Our system will automatically detect whether your email is linked to a paid subscription. Emails with a paid account will have full access to all API features, while emails without a subscription will generate PDF outputs with a demo watermark applied.
Please replace the "email" placeholder in the code with your actual email to test the API functionality.
<?php
function htmltopdfsdk()
{
$apikey = "XXXXXXXXXXXXXXXXXXXXXX";
$inputfile = "http://www.verypdf.com";
$url = "http://online.verypdf.com/app/onlineapi/";
$postfields = "apikey=" . $apikey ."&inputfile=". $inputfile . "&type=htmltopdfsdk&--title=HaHa123456HaHaHaHa";
$pdf = http_post($url, $postfields);
echo $pdf;
}
function htmltoimagesdk()
{
$apikey = "XXXXXXXXXXXXXXXXXXXXXX";
$inputfile = "http://www.verypdf.com";
$url = "http://online.verypdf.com/app/onlineapi/";
$postfields = "apikey=" . $apikey ."&inputfile=". $inputfile . "&type=htmltoimagesdk&outputfiletype=jpg";
$pdf = http_post($url, $postfields);
echo $pdf;
}
// htmltopdfsdk(); // uncomment this line to convert HTML to PDF
// htmltoimagesdk(); //uncomment this line to convert HTML to image
function http_post($url, $postfields)
{
if (!function_exists("curl_init"))
{
return "missing curl";
}
$c = curl_init();
curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($c, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
$http_code = 0;
$error = "";
$response = curl_exec($c);
$http_code = curl_getinfo($c, CURLINFO_HTTP_CODE);
$error_str = curl_error($c);
$error_nr = curl_errno($c);
curl_close($c);
if ($error_nr != 0) {
echo "info1:error ".$error_nr;
}
else if ($http_code == 200) {
return $response;
} else {
echo "info2:error ".$http_code;
}
}
?>
Above words have shown the basic usage of VeryPDF Web to PDF Converter Cloud API, and please do not hesitate to contact us when you have any questions.
Online Cloud API
Relative Products![]() |
![]() |
You may like these products