"""CC0 synthetic full-size multi-page PDF, October 5, 2026. Requires pypdf."""
from pathlib import Path
from pypdf import PdfWriter, PdfReader
from pypdf.generic import DictionaryObject, NameObject, DecodedStreamObject
import json, hashlib

ROOT = Path(__file__).resolve().parent
writer = PdfWriter()
font = writer._add_object(DictionaryObject({NameObject('/Type'): NameObject('/Font'), NameObject('/Subtype'): NameObject('/Type1'), NameObject('/BaseFont'): NameObject('/Helvetica')}))
for number in range(1, 51):
    page = writer.add_blank_page(width=612, height=792)
    page[NameObject('/Resources')] = DictionaryObject({NameObject('/Font'): DictionaryObject({NameObject('/F1'): font})})
    stream = DecodedStreamObject()
    stream.set_data(f'0 0 1 rg 20 20 {number * 10} 20 re f BT /F1 28 Tf 20 720 Td (Page {number} of 50) Tj ET\n'.encode('ascii'))
    page[NameObject('/Contents')] = writer._add_object(stream)
writer.add_metadata({'/Title': 'Filepetal sequential page rendering', '/Subject': 'CC0 synthetic fixture; 2026-10-05'})
path = ROOT / 'fifty-letter-pages.pdf'
with path.open('wb') as f: writer.write(f)
reader = PdfReader(path)
record = {'date': '2026-10-05', 'license': 'CC0', 'scope': 'Synthetic 50-page Letter fixture; not a maximum-capacity or physical-device benchmark', 'file': path.name, 'bytes': path.stat().st_size, 'sha256': hashlib.sha256(path.read_bytes()).hexdigest(), 'pages': len(reader.pages), 'page_dimensions_pt': [[float(p.mediabox.width), float(p.mediabox.height)] for p in reader.pages]}
(ROOT / 'input-manifest.json').write_text(json.dumps(record, indent=2) + '\n', encoding='utf-8')
print(json.dumps({k: v for k, v in record.items() if k != 'page_dimensions_pt'}))
