online / endpoints 62 / categories 10 / rate 60/min/ip /

GET /pdf

GET /pdf alias: /pdf

Returns a well-formed PDF: five-object document (Catalog, Pages node, Page, content stream with Helvetica text, and a link annotation to catastrophic.io). xref offsets accurate, page count honest, no encryption reference, no JavaScript actions. Counterpart to the chaos /pdf endpoint.

expect: 200 OK with Content-Type: application/pdf. Five-object PDF with accurate xref offsets, honest page count, and a clickable link annotation. Opens cleanly in any conformant PDF reader.

bash
curl -sD - 'https://not.catastrophic.io/pdf' -o /tmp/chaos.pdf | grep -i 'content-type\|x-chaos-pdf'
import io, urllib.request
resp = urllib.request.urlopen("https://not.catastrophic.io/pdf")
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Pdf-Mode:", resp.headers.get("X-Chaos-Pdf-Mode"))
print("X-Chaos-Pdf-Note:", resp.headers.get("X-Chaos-Pdf-Note"))
raw = resp.read()
# pip install pypdf
try:
    from pypdf import PdfReader
    reader = PdfReader(io.BytesIO(raw))
    print("Pages:", len(reader.pages))
except Exception as e:
    print("PdfReader error:", e)
const res = await fetch("https://not.catastrophic.io/pdf");
const bytes = new Uint8Array(await res.arrayBuffer());
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Pdf-Note:", res.headers.get("x-chaos-pdf-note"));
const header = new TextDecoder().decode(bytes.slice(0, 8));
console.log("Header:", header); // %PDF-1.4
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    resp, _ := http.Get("https://not.catastrophic.io/pdf")
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
    fmt.Println("X-Chaos-Pdf-Note:", resp.Header.Get("X-Chaos-Pdf-Note"))
    fmt.Println("Header bytes:", string(body[:8]))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://not.catastrophic.io/pdf")?;
    println!("Content-Type: {:?}", resp.headers().get("content-type"));
    println!("X-Chaos-Pdf-Note: {:?}", resp.headers().get("x-chaos-pdf-note"));
    let bytes = resp.bytes()?;
    println!("Header: {:?}", std::str::from_utf8(&bytes[..8.min(bytes.len())]));
    Ok(())
}
import java.net.URI;
import java.net.http.*;

public class PdfChaos {
    public static void main(String[] args) throws Exception {
        var client = HttpClient.newHttpClient();
        var req = HttpRequest.newBuilder(URI.create("https://not.catastrophic.io/pdf")).build();
        var resp = client.send(req, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println("Content-Type: " +
            resp.headers().firstValue("Content-Type").orElse(""));
        System.out.println("X-Chaos-Pdf-Note: " +
            resp.headers().firstValue("X-Chaos-Pdf-Note").orElse(""));
        var body = resp.body();
        System.out.println("Header: " +
            new String(body, 0, Math.min(8, body.length)));
    }
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://not.catastrophic.io/pdf");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine($"X-Chaos-Pdf-Note: " +
    $"{resp.Headers.GetValues("X-Chaos-Pdf-Note").FirstOrDefault()}");
var bytes = await resp.Content.ReadAsByteArrayAsync();
Console.WriteLine($"Header: " +
    $"{System.Text.Encoding.ASCII.GetString(bytes[..Math.Min(8, bytes.Length)])}");
require "net/http"
uri = URI("https://not.catastrophic.io/pdf")
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
    res = http.get(uri.request_uri)
    puts "Content-Type: #{res['Content-Type']}"
    puts "X-Chaos-Pdf-Note: #{res['X-Chaos-Pdf-Note']}"
    puts "Header: #{res.body[0..7]}"
end
$tmp = Join-Path $env:TEMP 'chaos.pdf'
$r = Invoke-WebRequest -Uri 'https://not.catastrophic.io/pdf' -OutFile $tmp -PassThru
"Content-Type: $($r.Headers['Content-Type'])"
"X-Chaos-Pdf-Note: $($r.Headers['X-Chaos-Pdf-Note'])"
# Open with default PDF viewer to observe reader behaviour
Start-Process $tmp