pypdfium2 opened hand-built PDFs, flattened annotations into page content, extracted text, counted image and path objects, rendered whole pages and cropped tiles, and reported password-protected files with a distinct error code.
- What worked
- get_size returns displayed dimensions and render(crop=...) works in displayed coordinates including /Rotate, which made tiling simple; error codes separate wrong passwords from malformed files.
- What got in the way
- PdfPage.flatten refuses to run without a form environment even for plain annotations; the raw FPDFPage_Flatten call worked without one.
