curl --request POST \
--url https://api.anchorbrowser.io/v1/tools/page-pdf \
--header 'Content-Type: application/json' \
--header 'anchor-api-key: <api-key>' \
--data '
{
"url": "<string>"
}
'import requests
url = "https://api.anchorbrowser.io/v1/tools/page-pdf"
payload = { "url": "<string>" }
headers = {
"anchor-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'anchor-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>'})
};
fetch('https://api.anchorbrowser.io/v1/tools/page-pdf', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anchorbrowser.io/v1/tools/page-pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"anchor-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.anchorbrowser.io/v1/tools/page-pdf"
payload := strings.NewReader("{\n \"url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("anchor-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.anchorbrowser.io/v1/tools/page-pdf")
.header("anchor-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anchorbrowser.io/v1/tools/page-pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["anchor-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": "<string>",
"details": [
"<string>"
]
}{
"error": "<string>"
}{
"error": "<string>"
}Get Page PDF
Generates a PDF of the current page for a browser session and returns it as a binary PDF file.
curl --request POST \
--url https://api.anchorbrowser.io/v1/tools/page-pdf \
--header 'Content-Type: application/json' \
--header 'anchor-api-key: <api-key>' \
--data '
{
"url": "<string>"
}
'import requests
url = "https://api.anchorbrowser.io/v1/tools/page-pdf"
payload = { "url": "<string>" }
headers = {
"anchor-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'anchor-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>'})
};
fetch('https://api.anchorbrowser.io/v1/tools/page-pdf', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.anchorbrowser.io/v1/tools/page-pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"anchor-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.anchorbrowser.io/v1/tools/page-pdf"
payload := strings.NewReader("{\n \"url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("anchor-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.anchorbrowser.io/v1/tools/page-pdf")
.header("anchor-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anchorbrowser.io/v1/tools/page-pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["anchor-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": "<string>",
"details": [
"<string>"
]
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
API key for your Anchor Browser account, sent as the anchor-api-key header on every
request. Create one at app.anchorbrowser.io (API Access),
or obtain one programmatically via the unauthenticated agent-access flow
(POST /v1/agent-access).
Query Parameters
Optional browser session ID. If omitted, url in the request body is required.
Body
The URL of the page to print to PDF.
Paper orientation. Defaults to false.
Display header and footer. Defaults to false.
Print background graphics. Defaults to false.
Scale of the webpage rendering. Defaults to 1.
0.1 <= x <= 2Paper width in inches. Defaults to 8.5.
Paper height in inches. Defaults to 11.
Top margin in inches. Defaults to ~0.4.
x >= 0Bottom margin in inches. Defaults to ~0.4.
x >= 0Left margin in inches. Defaults to ~0.4.
x >= 0Right margin in inches. Defaults to ~0.4.
x >= 0Page ranges to print, e.g. '1-5, 8, 11-13'. Defaults to all pages.
^\d+(-\d+)?(,\s*\d+(-\d+)?)*$HTML template for the print header.
HTML template for the print footer.
Prefer page size as defined by CSS. Defaults to false.
Response
PDF generated successfully
The response is of type file.
Was this page helpful?

