NewIntroducing semantic snapshotsPair every capture with structured DOM data →

For tools that save pages for later

Save any web page as a PDF, after its scripts have run

Point the request at a URL and get a paginated PDF back, rendered after the page's own scripts have run.

The problem

Read-later apps, research tools, client hand-offs and case files all want a page as a PDF. A browser's print dialog does not run on a server, a converter that skips JavaScript prints an empty shell, and the PDF that does come out has the cookie banner on page one and blank boxes where the images further down never loaded.

How domscout handles it

Send the url with format: pdf. The page loads in Chromium and its scripts run, and lazyScroll first scrolls down the page, up to twenty screens, so images that wait to be scrolled into view are loaded before printing. The PDF is printed the way Chromium prints, so the site's print stylesheet applies, with 10 mm margins and backgrounds included; set render.media to screen for the on-screen look instead. hideSelectors removes the elements you name, such as a cookie banner, and cleanup hides likely consent, chat and newsletter overlays without naming them.

Where it shows up

  • Save-to-PDF in a read-later or research app.
  • Client deliverables made from live pages.
  • A paginated copy of a page for a case file or an audit.

The request

POST /screenshot. PDF output starts at Pro. This request costs 3 credits: 1 for the capture, 1 for the PDF and 1 for lazyScroll. pdfFormat accepts A0 to A6, Letter, Legal, Tabloid and Ledger, and landscape turns the page.

cURL
curl -X POST https://api.domscout.io/screenshot \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/blog/annual-report",
    "format": "pdf",
    "pdfFormat": "A4",
    "lazyScroll": true,
    "hideSelectors": ["#cookie-banner"],
    "responseType": "binary"
  }' \
  -o page.pdf
Node.js
import { writeFile } from "node:fs/promises";

const response = await fetch("https://api.domscout.io/screenshot", {
  method: "POST",
  headers: { "Content-Type": "application/json", "x-api-key": "YOUR_API_KEY" },
  body: JSON.stringify({
    url: "https://example.com/blog/annual-report",
    format: "pdf",
    pdfFormat: "A4",
    lazyScroll: true,
    hideSelectors: ["#cookie-banner"],
    responseType: "binary"
  }),
});
await writeFile("page.pdf", Buffer.from(await response.arrayBuffer()));
Python
import requests

response = requests.post(
    "https://api.domscout.io/screenshot",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={
        "url": "https://example.com/blog/annual-report",
        "format": "pdf",
        "pdfFormat": "A4",
        "lazyScroll": True,
        "hideSelectors": ["#cookie-banner"],
        "responseType": "binary"
    },
)
with open("page.pdf", "wb") as f:
    f.write(response.content)
Go
package main

import (
	"bytes"
	"encoding/json"
	"io"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"url": "https://example.com/blog/annual-report",
		"format": "pdf",
		"pdfFormat": "A4",
		"lazyScroll": true,
		"hideSelectors": []any{"#cookie-banner"},
		"responseType": "binary",
	})
	req, _ := http.NewRequest("POST", "https://api.domscout.io/screenshot", bytes.NewReader(body))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("x-api-key", "YOUR_API_KEY")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := os.Create("page.pdf")
	defer out.Close()
	io.Copy(out, res.Body)
}
PHP
<?php
$ch = curl_init('https://api.domscout.io/screenshot');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'x-api-key: YOUR_API_KEY'],
    CURLOPT_POSTFIELDS => json_encode([
        'url' => 'https://example.com/blog/annual-report',
        'format' => 'pdf',
        'pdfFormat' => 'A4',
        'lazyScroll' => true,
        'hideSelectors' => ['#cookie-banner'],
        'responseType' => 'binary'
    ]),
]);
$response = curl_exec($ch);
if ($response === false) {
    throw new RuntimeException(curl_error($ch));
}
file_put_contents('page.pdf', $response);
Ruby
require "json"
require "net/http"

response = Net::HTTP.post(
  URI("https://api.domscout.io/screenshot"),
  {
    url: "https://example.com/blog/annual-report",
    format: "pdf",
    pdfFormat: "A4",
    lazyScroll: true,
    hideSelectors: ["#cookie-banner"],
    responseType: "binary"
  }.to_json,
  "Content-Type" => "application/json",
  "x-api-key" => "YOUR_API_KEY"
)
File.binwrite("page.pdf", response.body)
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;

public class Capture {
    public static void main(String[] args) throws Exception {
        String body = """
            {
                "url": "https://example.com/blog/annual-report",
                "format": "pdf",
                "pdfFormat": "A4",
                "lazyScroll": true,
                "hideSelectors": ["#cookie-banner"],
                "responseType": "binary"
            }
            """;
        HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.domscout.io/screenshot"))
            .header("Content-Type", "application/json")
            .header("x-api-key", "YOUR_API_KEY")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();
        HttpResponse<Path> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofFile(Path.of("page.pdf")));
        System.out.println("Saved " + response.body());
    }
}
C#
using System.Net.Http.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");

var response = await client.PostAsJsonAsync("https://api.domscout.io/screenshot", new {
    url = "https://example.com/blog/annual-report",
    format = "pdf",
    pdfFormat = "A4",
    lazyScroll = true,
    hideSelectors = new[] { "#cookie-banner" },
    responseType = "binary"
});
await File.WriteAllBytesAsync("page.pdf", await response.Content.ReadAsByteArrayAsync());

Go further

More in Screenshots, images and PDFs: Thumbnails and link previews · PDFs from your own HTML · HTML to image · Screenshots of a list of URLs · Product screenshots for docs · Dashboard screenshots to chat · Monthly reports for clients · Email template previews · Full-page captures for review tools · All use cases

Give your product a browser.

Get clean web content and visual proof into your workflow in minutes.