NewIntroducing semantic snapshotsPair every capture with structured DOM data →

For products that send documents

Turn the HTML you already have into a PDF

Send HTML in the request and get a PDF back, laid out by real Chromium at the paper size you choose.

The problem

Invoices, receipts, reports, certificates: documents your product already knows how to draw as HTML, that somebody now wants as a PDF. A converter that is not a real browser can lay the page out differently from the browser you designed it in, and running Chromium next to your app to avoid that is its own project.

How domscout handles it

Send the HTML in the request instead of a URL, with format: pdf, and it is laid out by Chromium and returned as a PDF. pdfFormat sets the paper size (A0 to A6, Letter, Legal, Tabloid or Ledger), landscape turns the page, and backgrounds are printed unless you set printBackground to false. With responseType: binary the response body is the PDF itself. A request can carry up to 1,000,000 characters of HTML.

Where it shows up

  • Invoices and receipts generated when an order completes.
  • Reports rendered from the same template as the page in your app.
  • Certificates and handouts produced from a course or event record.

The request

POST /screenshot. PDF output starts at Pro. A PDF costs 2 credits: 1 for the capture and 1 for the PDF.

cURL
curl -X POST https://api.domscout.io/screenshot \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
    "format": "pdf",
    "pdfFormat": "A4",
    "responseType": "binary"
  }' \
  -o invoice.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({
    html: "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
    format: "pdf",
    pdfFormat: "A4",
    responseType: "binary"
  }),
});
await writeFile("invoice.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={
        "html": "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
        "format": "pdf",
        "pdfFormat": "A4",
        "responseType": "binary"
    },
)
with open("invoice.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{
		"html": "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
		"format": "pdf",
		"pdfFormat": "A4",
		"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("invoice.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([
        'html' => '<h1>Invoice 1042</h1><p>Total: $120.00</p>',
        'format' => 'pdf',
        'pdfFormat' => 'A4',
        'responseType' => 'binary'
    ]),
]);
$response = curl_exec($ch);
if ($response === false) {
    throw new RuntimeException(curl_error($ch));
}
file_put_contents('invoice.pdf', $response);
Ruby
require "json"
require "net/http"

response = Net::HTTP.post(
  URI("https://api.domscout.io/screenshot"),
  {
    html: "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
    format: "pdf",
    pdfFormat: "A4",
    responseType: "binary"
  }.to_json,
  "Content-Type" => "application/json",
  "x-api-key" => "YOUR_API_KEY"
)
File.binwrite("invoice.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 = """
            {
                "html": "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
                "format": "pdf",
                "pdfFormat": "A4",
                "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("invoice.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 {
    html = "<h1>Invoice 1042</h1><p>Total: $120.00</p>",
    format = "pdf",
    pdfFormat = "A4",
    responseType = "binary"
});
await File.WriteAllBytesAsync("invoice.pdf", await response.Content.ReadAsByteArrayAsync());

Go further

Other use cases: Web access for AI agents · Website change monitoring · Web archiving and evidence · Crawling a whole site · SEO regression checks · Thumbnails and link previews · Structured data from web pages · Link preview checks · Responsive layout checks

Give your product a browser.

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