audit-pdf-viewer

Audit PyMuPDF (fitz) PDF viewer code for file-handle lifecycle and rendering issues.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/ElPoot/contabilidad --skill audit-pdf-viewer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-pdf-viewer
Source: https://github.com/ElPoot/contabilidad/tree/main/.agents/skills/audit-pdf-viewer
Command: npx skills add https://github.com/ElPoot/contabilidad --skill audit-pdf-viewer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps detect issues in the PDF viewer lifecycle where PyMuPDF/fitz may keep file handles open, mishandle OneDrive placeholders, or cause rendering/text-selection failures that can later block file classification workflows.

Core Features & Use Cases

  • File-handle lifecycle auditing: Verifies that fitz.open() is paired with explicit/guaranteed close() (including try/finally or context-managed patterns) and that handles are released before downstream classification.
  • Placeholder detection for OneDrive paths: Checks whether placeholder files (e.g., zero-byte stubs) are detected and safely handled to avoid crashes or incorrect processing.
  • Rendering and text extraction checks: Reviews zoom/pixmap rendering and text/word extraction code paths that support selection in the viewer.
  • Use case: When PDFs are heavy or sometimes “don’t load,” run this audit to pinpoint where rendering or handle release breaks, especially around transitions that lead to PermissionError/locked-file behavior.

Quick Start

Ask the auditor to review the current code for gestor_contable/gui/pdf_viewer.py and gestor_contable/config.py and produce the “AUDITORIA: VISOR PDF” report with any real findings only.

Frequently Asked Questions about audit-pdf-viewer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does PyMuPDF keep file handles locked after closing a PDF viewer?

PyMuPDF keeps file handles locked when fitz.open() lacks a guaranteed close() in a try/finally or context-managed block, preventing handle release before downstream file classification. Auditing the viewer lifecycle confirms handles are explicitly closed and released before transition.

How do I prevent PDF rendering failures with heavy PDFs in a PyMuPDF viewer?

Prevent heavy PDF rendering failures by auditing zoom and pixmap rendering code paths alongside text extraction operations. Reviewing these viewer workflows pinpoints where rendering breaks or text selection extraction fails during large document processing.

How do I handle OneDrive placeholder files when extracting text from PDFs?

Handle OneDrive placeholder files by detecting zero-byte stubs before passing them to PyMuPDF. Auditing placeholder detection logic ensures your viewer safely skips or requests these files, avoiding crashes and incorrect text extraction.

What is the best way to audit a PDF viewer for text selection and extraction issues?

The best way to audit text selection issues is reviewing PyMuPDF word and text extraction code paths within the viewer. Validating these rendering operations ensures zoom levels and pixmap generation correctly support UI selection.

Can I use this audit to fix PermissionError on locked files in my PDF viewer workflow?

Yes, you can use this audit to fix PermissionError by verifying the fitz open and close lifecycle. Enforcing explicit handle release before classification ordering resolves locked-file behavior that blocks downstream workflow access.