Repository navigation
Add opt-in CAD PDF rejection and loss warnings - #2668
Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 3 commits into
Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 3 commits into
Çağdaş Yürekli (cagdasyurekli) wants to merge 3 commits into
Conversation
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CAD-exported PDFs can return successful Markdown containing only labels, or effectively no content, while losing the drawing. Add an opt-in
--reject-cad-pdfs/convert(..., reject_cad_pdfs=True)policy that rejects PDFs identifying AutoCAD, Revit, SolidWorks, or MicroStation in Creator/Producer metadata.The check runs locally before converter selection, so plugins, cloud converters, and extraction fallbacks cannot bypass it. When the option is omitted, extraction and Markdown content remain unchanged, but a successfully converted PDF identifying a known CAD exporter emits a
UserWarning(stderr in the CLI). Warning detection is best-effort and does not block custom/cloud conversion if PDF dependencies or inspectable metadata are absent. CLI rejection occurs before output is written.This is a conservative exporter policy, not a drawing classifier: it also rejects text-heavy exports from those applications and cannot detect missing/rewritten metadata or unknown exporters. Passing the check does not establish fidelity. ZIP input retains its existing unsupported-member skipping behavior. Faithful drawing interpretation is outside this change.
Closes #2667.
Validation:
GITHUB_ACTIONS=true python -m pytest packages/markitdown/tests -q, Python 3.12).git diff --checkpassed./creatorinstead of/Creator; two additional regression cases fail before that correction and pass afterward. Two processed drawing documents identify PowerPoint or a scanner and demonstrate the documented detection limit. Third-party PDFs are not included in the repository.Public direct-export samples: Revit 2026, SOLIDWORKS 2024, SOLIDWORKS 2025, MicroStation 8.5, and AutoCAD LT 2024. Conversion was tested on complete documents; 11 representative pages across the seven PDFs were rendered and visually inspected. The PowerPoint-processed document already has visible overlap in its source; that is not attributed to MarkItDown.
Scope: net +84 production lines, +208 test lines, +38 documentation lines. No new runtime or test dependencies.
Three warning regressions failed before the warning change and pass afterward. PDF metadata is inspected with pdfminer without loading pages, preserving the one-pass page-cleanup behavior verified by the existing memory tests. Drawing-aware extraction and Markdown reporting are separate proposals; this PR does not change the default to rejection.