Feature request: reject known CAD-exported PDFs when partial text extraction is unacceptable

Aperta
#2,667 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@cagdasyurekli ci sta già lavorando.

Dal 7/10/2026.

  • #2668 di @cagdasyurekli — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
36/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, cli

Direzione di ricerca

Open PR #2668 already targets this issue, so check its state and the thread before starting any work. The change spans three areas: the conversion entry point where the reject_cad_pdfs keyword is accepted, the CLI parser that must add --reject-cad-pdfs, and the PDF converter path where Creator/Producer metadata is inspected before a converter (or plugin/cloud converter) is selected. Done looks like known CAD exporters raising an actionable exception, unchanged default extraction otherwise, plus the generated-PDF regression tests covering labeled and geometry-only drawings, unknown metadata, non-PDF inputs, plugins and CLI file/stdin rejection.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CAD-exported PDFs can produce successful but incomplete Markdown because drawing geometry is not represented in the output. Can MarkItDown offer an explicit rejection policy for callers who cannot accept this loss?

Observed behavior

Tested current main at 4cc9fa17653d695d64fb9eee5b33d4de55ff84e8 with synthetic, valid vector PDFs (not files exported by an installed CAD application):

  • A floor plan with vector room outlines and embedded ROOM A / ROOM B labels converts successfully, returning the labels without the room outlines or spatial relationships.
  • A geometry-only variant also returns successfully, with effectively empty output.
  • Enabling the OCR plugin does not recover the labeled vector plan: it contains extractable text but no embedded raster images, so the plugin follows its text extraction path. This was tested locally without invoking an external model.

Autodesk also documents that SHX text may be exported as geometry, comments, or hidden text. This creates a second way for plain text extraction to omit content:
https://help.autodesk.com/cloudhelp/2024/ENU/AutoCAD-Core/files/GUID-56EA988C-A1DA-4E85-8765-B3F31A01AB02.htm

Proposed bounded fix

Add --reject-cad-pdfs and the conversion keyword reject_cad_pdfs=True. Check PDF Creator/Producer metadata for explicitly named CAD exporters before selecting a converter. Reject known matches with an actionable exception, including when plugins or cloud converters are enabled. Preserve existing extraction behavior when the policy is not requested.

This is an exporter-based policy, not a drawing classifier or a guarantee of conversion fidelity. Missing/rewritten metadata and unrecognized exporters cannot be detected by it. It may also reject text-heavy documents exported by those applications; the caller explicitly chooses that conservative policy. A line-count heuristic would misclassify tables and ordinary charts.

Full drawing interpretation would require a separate rendered-page/vision workflow and validation; OCR alone cannot guarantee dimensions, topology, or geometric relationships. I am proposing the small rejection feature rather than claiming faithful drawing conversion.

Regression coverage

Use generated PDFs with correct xref offsets to cover labeled and geometry-only drawings, Creator/Producer identification, unknown metadata, unchanged default extraction, non-PDF inputs, plugins, and CLI file/stdin rejection before writing output.

Related: #296 discusses general PDF fidelity. I found no CAD/AutoCAD/SHX-specific issue or PR in the repository searches.

Lingua principale
Python
Stelle
198k
Fork
15k
Merge medio
2h 16m
PR unite (30g)
9

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/markitdown

Tutte le issue di microsoft/markitdown

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.