PDF to Markdown for LLM pipelines in .NET – without Python and without native libraries
Most retrieval-augmented generation (RAG) pipelines start the same way: take a PDF, pull out the text, split it into
chunks, embed the chunks. The first step looks trivial and is where many pipelines quietly lose quality. A language
model can only answer from what the extractor hands it – and a typical extractor hands it text in the order the
characters happen to sit on the page.
This article shows what goes wrong, and how to get structured Markdown and clean chunks out of PDFs in a .NET service
with miPDFlib , an Apache-2.0 PDF library in pure managed code. (Disclosure: I
wrote it.)
What a plain text extractor gives you
Take an ordinary report page: a heading, two columns of text, a table, a running head at the top and a page number at
the bottom.…