PDF-X-RAY

Japanese version
Linter, validator, and MCP scanner for AI-generated PDFs.
Stop discovering silent PDF failures after a human opens the document. PDF-X-RAY checks fonts, text boundaries, blank pages, local links, metadata, and raster-image DPI, then returns deterministic evidence through VS Code, CLI, and MCP.
Why use PDF-X-RAY?
A PDF generator can exit successfully while producing a document with unembedded CJK fonts, blank pages, machine-local links, exposed author metadata, text near a page boundary, or stretched low-resolution images. These defects can look correct in a generated-file preview and still fail during review or distribution.
PDF-X-RAY closes the generation-and-verification loop:
AI agent generates or edits a PDF
|
v
PDF-X-RAY scan -> Problems and structured findings
|
v
AI agent applies an explicit safe repair or regenerates the source
|
v
PDF-X-RAY rescan -> resolved, remaining, or regressed findings
Built for AI agents and developers
- VS Code diagnostics: Scan an active PDF or the workspace and review findings in Problems.
- Structured MCP results: Compatible VS Code AI clients receive stable IDs, locations, evidence, and rule-specific findings through the bundled local stdio MCP server.
- CLI and CI/CD checks: Save JSON scans and compare before-and-after reports in automated workflows.
- Bounded correction: Repair only conclusive blank-page and metadata findings. Font, layout, link, and DPI findings return to the source document for correction.
- Local deterministic analysis: The VS Code extension, CLI, and MCP server use the same local scan engine without uploading the PDF.
Quick start
- Open VS Code.
- Press
Ctrl+P on Windows or Linux, or Cmd+P on macOS.
- Run:
ext install ShunsukeF.pdf-xray
- Open a
.pdf file.
- Run PDF-X-RAY: Scan Active PDF from the Command Palette.
- Review findings in Problems. For a repairable PDF, run PDF-X-RAY: Apply Safe Repairs, then rescan.
AI-agent workflow
Tell Copilot in agent mode:
Generate the report PDF, run pdfx_scan, apply only PDF-X-RAY safe repairs, rescan, and report font, layout, or DPI findings that require regeneration of the source document.
The extension contributes the following VS Code commands:
PDF-X-RAY: Scan Active PDF
PDF-X-RAY: Scan Workspace
PDF-X-RAY: Apply Safe Repairs
PDF-X-RAY: Copy AI Report
PDF-X-RAY: Save AI Report
Rules
| Rule |
Severity |
Detects |
Repair policy |
PDF-001 |
Error / Warning |
Unembedded fonts and CJK fonts without /ToUnicode |
Report the exact font; regenerate with font embedding |
PDF-002 |
Error |
Text-matrix origins outside configurable safe margins |
Report for source-side reflow |
PDF-003 |
Warning |
Pages with no content stream data |
Remove only when the PDF has more than one page |
PDF-005 |
Warning |
file://, local Windows paths, and placeholder links |
Report annotation evidence |
PDF-006 |
Info |
Placeholder titles and exposed author or creator metadata |
Normalize the title and clear personal author metadata |
PDF-007 |
Warning |
Embedded raster images below the effective-DPI threshold when transform evidence is available |
Report dimensions and DPI; regenerate the image placement |
MCP integration
Installing the extension registers a local stdio MCP server with compatible VS Code clients. The server exposes:
pdfx_scan
pdfx_repair
pdfx_scan_workspace
pdfx_diff_scans
Standalone MCP clients can launch the bundled server documented by the extension. No PDF is uploaded to an external service during scanning.
CLI
From a built repository checkout:
node dist/cli.cjs scan .\report.pdf
node dist/cli.cjs repair .\report.pdf
node dist/cli.cjs scan .\report.pdf --json report.json --fail-on-error
node dist/cli.cjs diff .\before.json .\after.json --fail-on-regressed
Typical use cases
- Validate an AI-generated report before it is distributed or sent for review.
- Detect CJK font embedding defects before a PDF leaves its generation environment.
- Remove conclusive blank pages and personal author metadata without changing page content.
- Give an MCP-capable agent deterministic evidence for source-side correction and a rescan.
- Add PDF regression checks to a local or CI/CD validation workflow.
Safety and limitations
- Scans do not upload or render the source PDF in a browser.
- Repair is limited to conclusive blank-page removal and title or personal-metadata normalization.
- PDF-X-RAY does not guess at font embedding, paragraph reflow, whole-page scaling, or source regeneration.
- Layout and effective-DPI findings depend on object-model evidence stored in the PDF. Use a visual review for requirements that cannot be represented by that evidence.
Part of AI-IN-THE-LOOP PACK
AI-IN-THE-LOOP PACK provides deterministic checks for AI-generated non-code artifacts.
Report bugs and request features in GitHub Issues.