Turn scanned PDFs into RAG-ready .md.
Eliminate broken table columns, scrambled multi-column text, and lost page citations. Output clean, structured Markdown ready for vector search and header-based chunking.
Why RAG fails on raw PDFs
Fix the three root causes of poor RAG retrieval before embedding.
-
01
Keep table columns aligned
Standard PDF text extractors flatten borders and merged cells, detaching numbers from their row headers. AI-MD recognizes table geometry visually and rebuilds aligned Markdown pipe tables.
-
02
Clean scan noise & multi-column layouts
Merged left-right columns and scanner streak artifacts pollute vector embeddings. We deskew and denoise each page image first, then reconstruct paragraphs in true reading order.
-
03
Preserve page citations in every chunk
Plain text extraction strips page boundaries. By injecting explicit [P.001] heading anchors on every page, your RAG pipeline can cite exact source PDF pages in answers.
Chunking & Ingestion
Split by Markdown headers and ingest straight into your vector DB.
Delivered with page-level headings and aligned Markdown pipe tables
# Boiler Safety Manual (Rev. 2026) ## [P.014] 3.2 Operating Pressure Limits Inspect relief valves before exceeding nominal load thresholds. | Model | Rated Pressure | Max Temp | Inspection Cycle | | :--- | :--- | :--- | :--- | | Type-A200 | 0.85 MPa | 180 °C | Every 6 months | | Type-B500 | 1.40 MPa | 220 °C | Every 3 months |
Chunk with page metadata intact using MarkdownHeaderTextSplitter
from langchain_text_splitters import MarkdownHeaderTextSplitter
splitter = MarkdownHeaderTextSplitter(
headers_to_split_on=[("#", "doc_title"), ("##", "page_section")]
)
chunks = splitter.split_text(open("manual.md", encoding="utf-8").read())
# chunks[0].metadata -> {"doc_title": "Boiler Safety Manual (Rev. 2026)",
# "page_section": "[P.014] 3.2 Operating Pressure Limits"}