application/pdf

PDF sample document files for testing

Download a verified PDF fixture for uploads, page counting, previews, downloads, signatures, and MIME validation.

Verified . Signature, MIME, exact bytes, SHA-256, page count, preview fallback, and download headers are checked.

Identify PDF files

Magic signature
25 50 44 46 (%PDF)
Registered MIME
application/pdf

PDF uses indirect objects and cross-reference data. A leading signature alone does not prove that the full document is structurally safe.

Choosing PDF

PDF can be previewed by current browsers and document services, although embedded viewers and security policies vary.

Use PDF for fixed-layout preview and page-count workflows.

Treat parsing as untrusted work and keep a download fallback.

Common test cases

  • Document upload validation
  • Page count and preview generation
  • Content-Disposition tests

Invalid and boundary cases

  • Truncated cross-reference data
  • Encrypted or password-protected PDF
  • Active or embedded content

PDF fixture matrix

FileStructureMIMESize
Sample document PDFsample-document.pdf1 pageapplication/pdf9 KB

Verify the representative fixture

Each command downloads sample-document.pdf and uses its published URL. The Node.js and Python examples also verify the exact byte count and SHA-256 digest.

curl

Download the published fixture and inspect its response headers before saving the exact bytes.

curl --fail --location --silent --show-error \
  --output sample-document.pdf \
  --write-out 'status=%{http_code}\ncontent_type=%{content_type}\nbytes=%{size_download}\n' \
  'https://assets.testfiles.dev/documents/sample-document.pdf'
wget

Save the stable fixture URL without changing the published byte stream.

wget --output-document='sample-document.pdf' 'https://assets.testfiles.dev/documents/sample-document.pdf'
Node.js

Verify the downloaded byte count and SHA-256 digest in a Node.js workflow.

import assert from "node:assert/strict";
import { createHash } from "node:crypto";

const response = await fetch("https://assets.testfiles.dev/documents/sample-document.pdf");
assert.equal(response.ok, true);
assert.match(response.headers.get("content-type") ?? "", /application\/pdf/i);

const bytes = Buffer.from(await response.arrayBuffer());
assert.equal(bytes.length, 9051);
assert.equal(createHash("sha256").update(bytes).digest("hex"), "c0ca139748753dd192bda50ea731868e8f832b5ed97499d12ffb2c995791ffbc");
console.log("Verified sample-document.pdf", bytes.length, "bytes");
Python Requests

Verify the same fixture from a Python test or processing pipeline.

import hashlib
import requests

url = "https://assets.testfiles.dev/documents/sample-document.pdf"
response = requests.get(url, timeout=30)
response.raise_for_status()

assert "application/pdf" in response.headers.get("content-type", "")
assert len(response.content) == 9051
assert hashlib.sha256(response.content).hexdigest() == "c0ca139748753dd192bda50ea731868e8f832b5ed97499d12ffb2c995791ffbc"
print("Verified sample-document.pdf", len(response.content), "bytes")

Continue testing

Related formats

Copied