This is an outdated version of the HTML To PDF API. Please refer to Latest Version Documentation for the greatest functionality.
Restpack HTML to PDF API is an easy to use RESTful web service that can capture live web pages and deliver the structured view as a PDF document. The service sits on a fully functional browser rendering engine with rich html / css / js capabilities.
With each API call, you must provide an authentication token. To create a new access token please refer to user tokens page on your account dashboard.
You can either provide the access token within the querystring or as a header.
access_token
querystring parameter. As in https://restpack.io/api/html2pdf/capture?access_token={TOKEN}
X-Access-Token
header.Access token errors are represented in 4xx
class HTTP errors.
In order to create a pdf, you simply need to invoke a GET / POST request on the following URL. You can capture publicly accessible URL with GET Request, or Raw HTML string with POST Request.
urlurl | The URL of web page, including the protocol that you want to capture. Example: http://example.com |
access_tokenstring | Your personal access token for API access. Example: XXXXXXXX |
jsonboolean | Return a JSON response with the resulting image's URL instead of the image itself. Default: false |
widthinteger | Preferred viewport width in pixels. Default: 1024Min: 10Max: 4096 |
heightinteger | Preferred viewport width in pixels. Requires `width` to be set. Min: 10Max: 4096 |
inject_cssstring | An external CSS file URL or Plain CSS to be injected into the page before render. |
inject_jsstring | An external JS file URL or Plain CSS to be injected into the page before render. |
delaynumber | Time in seconds to delay capture after page load. Default: 2Max: 10 |
ttlnumber | Time in seconds for the resulting image to be cached for further requests. Default: 86400 (1 day)Max: 2592000 (1 month) |
freshboolean | Force rendering a new screenshot disregarding the cache status. Default: false |
shutter_elementstring | A CSS selector for the shutter element. Capturing will wait for this element to be found within document. Example: body div.withclass |
shutter_functionstring | A function name to be exported on the `window` object of target web page. Capturing will wait for this function to be called. Example: captureSS |
header_uastring | Custom user-agent header string for the web request. Default: Chrome Compatible User Agent |
header_langstring | Custom accept-language header string for the web request. |
html_datastring | Raw HTML string of a page that you want to capture. Example: <html><body>.... |
access_tokenstring | Your personal access token for API access. Example: XXXXXXXX |
jsonboolean | Return a JSON response with the resulting image's URL instead of the image itself. Default: false |
widthinteger | Preferred viewport width in pixels. Default: 1024Min: 10Max: 4096 |
heightinteger | Preferred viewport width in pixels. Requires `width` to be set. Min: 10Max: 4096 |
inject_cssstring | An external CSS file URL or Plain CSS to be injected into the page before render. |
inject_jsstring | An external JS file URL or Plain CSS to be injected into the page before render. |
delaynumber | Time in seconds to delay capture after page load. Default: 2Max: 10 |
ttlnumber | Time in seconds for the resulting image to be cached for further requests. Default: 86400 (1 day)Max: 2592000 (1 month) |
freshboolean | Force rendering a new screenshot disregarding the cache status. Default: false |
shutter_elementstring | A CSS selector for the shutter element. Capturing will wait for this element to be found within document. Example: body div.withclass |
shutter_functionstring | A function name to be exported on the `window` object of target web page. Capturing will wait for this function to be called. Example: captureSS |
header_uastring | Custom user-agent header string for the web request. Default: Chrome Compatible User Agent |
header_langstring | Custom accept-language header string for the web request. |
This is the default operation mode of the API. You can control the width of captured viewport using width
parameter. The engine will figure out the complete height of the page and return the entire screen capture.
http GET 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480' \
x-access-token:TOKEN
curl --request GET \
--url 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480' \
--header 'x-access-token: TOKEN'
var request = require("request");
var options = { method: 'GET',
url: 'https://restpack.io/api/html2pdf/convert',
qs: { url: 'http://google.com', width: '1480' },
headers: { 'x-access-token': 'TOKEN' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
require 'uri'
require 'net/http'
url = URI("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-access-token"] = 'TOKEN'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("restpack.io")
headers = { 'x-access-token': "TOKEN" }
conn.request("GET", "/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-access-token", "TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: TOKEN"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.get("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=1480")
.header("x-access-token", "TOKEN")
.asString();
In order to specify a strict viewport, provide a height
parameter along with the width
parameter. By default height
is not set and weight
is defined as 1024.
For example, if you wish to capture with an iPhone 6 viewport size, the width
parameter should be set 375
and height 667
. While using mobile viewports, don’t forget to also provide a user agent header.
http GET 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667' \
x-access-token:TOKEN
curl --request GET \
--url 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667' \
--header 'x-access-token: TOKEN'
var request = require("request");
var options = { method: 'GET',
url: 'https://restpack.io/api/html2pdf/convert',
qs: { url: 'http://google.com', width: '375', height: '667' },
headers: { 'x-access-token': 'TOKEN' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
require 'uri'
require 'net/http'
url = URI("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-access-token"] = 'TOKEN'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("restpack.io")
headers = { 'x-access-token': "TOKEN" }
conn.request("GET", "/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-access-token", "TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: TOKEN"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.get("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&width=375&height=667")
.header("x-access-token", "TOKEN")
.asString();
By default, capturing engine waits for the page load and then 2
more seconds for initial javascripts to settle their rendering. You can control this duration using delay
parameter (in seconds) from instantaneous to 10 seconds.
http GET 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5' \
x-access-token:TOKEN
curl --request GET \
--url 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5' \
--header 'x-access-token: TOKEN'
var request = require("request");
var options = { method: 'GET',
url: 'https://restpack.io/api/html2pdf/convert',
qs: { url: 'http://google.com', delay: '5' },
headers: { 'x-access-token': 'TOKEN' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
require 'uri'
require 'net/http'
url = URI("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-access-token"] = 'TOKEN'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("restpack.io")
headers = { 'x-access-token': "TOKEN" }
conn.request("GET", "/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-access-token", "TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: TOKEN"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.get("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&delay=5")
.header("x-access-token", "TOKEN")
.asString();
In addition to a fixed delay setting, a shutter mechanism can be provided. In order to wait for an element to be visible in the page, provide shutter_element
parameter with the global css selector for that element.
If you need to have a more granular control of shutter, you can provide a shutter_function
name. This will be a global function on the page’s window
object. When called within the page, initiates the capturing process. If you are not in control o the target page, you can mix this with inject_js
parameter to gain control.
http GET 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass' \
x-access-token:TOKEN
curl --request GET \
--url 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass' \
--header 'x-access-token: TOKEN'
var request = require("request");
var options = { method: 'GET',
url: 'https://restpack.io/api/html2pdf/convert',
qs: { url: 'http://google.com', shutter_element: 'div.someclass' },
headers: { 'x-access-token': 'TOKEN' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
require 'uri'
require 'net/http'
url = URI("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-access-token"] = 'TOKEN'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("restpack.io")
headers = { 'x-access-token': "TOKEN" }
conn.request("GET", "/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-access-token", "TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: TOKEN"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.get("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass")
.header("x-access-token", "TOKEN")
.asString();
The API caches generated PDF documents up to a specified time period. If you request a PDF of a previously cached web page, result will be provided from the cache. It is possible to control the duration of cache using ttl
parameter (in seconds)
In addition to setting a ttl
, it is possible to use fresh=true
prameter to invalidate cache and capture a new PDF.
http GET 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60' \
x-access-token:TOKEN
curl --request GET \
--url 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60' \
--header 'x-access-token: TOKEN'
var request = require("request");
var options = { method: 'GET',
url: 'https://restpack.io/api/html2pdf/convert',
qs: { url: 'http://google.com', ttl: '60' },
headers: { 'x-access-token': 'TOKEN' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
require 'uri'
require 'net/http'
url = URI("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-access-token"] = 'TOKEN'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("restpack.io")
headers = { 'x-access-token': "TOKEN" }
conn.request("GET", "/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-access-token", "TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: TOKEN"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.get("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&ttl=60")
.header("x-access-token", "TOKEN")
.asString();
While the service uses reasonable defaults for user agents and accept language headers, it is possible to customize these headers.
http GET 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es' \
x-access-token:TOKEN
curl --request GET \
--url 'https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es' \
--header 'x-access-token: TOKEN'
var request = require("request");
var options = { method: 'GET',
url: 'https://restpack.io/api/html2pdf/convert',
qs:
{ url: 'http://google.com',
header_ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3',
header_lang: 'es' },
headers: { 'x-access-token': 'TOKEN' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
require 'uri'
require 'net/http'
url = URI("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-access-token"] = 'TOKEN'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("restpack.io")
headers = { 'x-access-token': "TOKEN" }
conn.request("GET", "/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-access-token", "TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: TOKEN"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.get("https://restpack.io/api/html2pdf/convert?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es")
.header("x-access-token", "TOKEN")
.asString();