<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wolfgang Mitterbucher</title>
    <description>The latest articles on DEV Community by Wolfgang Mitterbucher (@wolfgang_mitterbucher_dd5).</description>
    <link>https://dev.to/wolfgang_mitterbucher_dd5</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4247911%2F33b959fc-281b-43bc-bb06-ad641099ee3d.jpg</url>
      <title>DEV Community: Wolfgang Mitterbucher</title>
      <link>https://dev.to/wolfgang_mitterbucher_dd5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wolfgang_mitterbucher_dd5"/>
    <language>en</language>
    <item>
      <title>PDF to Markdown for LLM pipelines in .NET – without Python and without native libraries</title>
      <dc:creator>Wolfgang Mitterbucher</dc:creator>
      <pubDate>Mon, 16 Nov 2026 14:38:29 +0000</pubDate>
      <link>https://dev.to/wolfgang_mitterbucher_dd5/pdf-to-markdown-for-llm-pipelines-in-net-without-python-and-without-native-libraries-436b</link>
      <guid>https://dev.to/wolfgang_mitterbucher_dd5/pdf-to-markdown-for-llm-pipelines-in-net-without-python-and-without-native-libraries-436b</guid>
      <description>&lt;h1&gt;
  
  
  PDF to Markdown for LLM pipelines in .NET – without Python and without native libraries
&lt;/h1&gt;

&lt;p&gt;Most retrieval-augmented generation (RAG) pipelines start the same way: take a PDF, pull out the text, split it into&lt;br&gt;
chunks, embed the chunks. The first step looks trivial and is where many pipelines quietly lose quality. A language&lt;br&gt;
model can only answer from what the extractor hands it – and a typical extractor hands it text in the order the&lt;br&gt;
characters happen to sit on the page.&lt;/p&gt;

&lt;p&gt;This article shows what goes wrong, and how to get structured Markdown and clean chunks out of PDFs in a .NET service&lt;br&gt;
with &lt;a href="https://github.com/Mibuw/miPDFlib" rel="noopener noreferrer"&gt;miPDFlib&lt;/a&gt;, an Apache-2.0 PDF library in pure managed code. (Disclosure: I&lt;br&gt;
wrote it.)&lt;/p&gt;
&lt;h2&gt;
  
  
  What a plain text extractor gives you
&lt;/h2&gt;

&lt;p&gt;Take an ordinary report page: a heading, two columns of text, a table, a running head at the top and a page number at&lt;br&gt;
the bottom. Read line by line, as most extractors do by default, it comes out like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Water Utility – Quarterly Report
2 Operations
Pumps in the northern plant ran at Energy use per cubic metre fell
92 percent of their rated capacity for the fourth quarter in a row. The
during the second quarter. The two largest saving came from the new
older units were replaced in May, variable-speed drives, which adjust
which cut maintenance hours by the pump speed to the demand in
almost a third. the network.
Plant Capacity Energy (kWh/m³)
North 92 % 0.41
South 87 % 0.45
Page 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every word is there, so a quick check passes. But the sentences of the two columns are interleaved ("ran at Energy use&lt;br&gt;
per cubic metre fell"), the table has lost its columns, and the running head and page number sit in the middle of the&lt;br&gt;
content – on every page. Chunk this and embed it, and the retriever finds chunks that mix two topics, the model reads&lt;br&gt;
numbers without knowing which column they belong to, and "Page 1" ends up in the vector index a few hundred times.&lt;/p&gt;
&lt;h2&gt;
  
  
  Markdown instead of text
&lt;/h2&gt;

&lt;p&gt;The structure is there on the page; it just has to be read. &lt;code&gt;PdfLayoutExport.ToMarkdown&lt;/code&gt; analyses the layout first –&lt;br&gt;
columns, blocks, headings, lists, tables, headers and footers – and writes what it finds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nc"&gt;MiPdf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nc"&gt;MiPdf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;document&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PdfDocument&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"report.pdf"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;markdown&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PdfLayoutExport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToMarkdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# 2 Operations
&lt;/span&gt;
Pumps in the northern plant ran at 92 percent of their rated capacity during the second quarter. The two older units were replaced in May, which cut maintenance hours by almost a third.

Energy use per cubic metre fell for the fourth quarter in a row. The largest saving came from the new variable-speed drives, which adjust the pump speed to the demand in the network.

| Plant | Capacity | Energy (kWh/m³) |
| --- | --- | --- |
| North | 92 % | 0.41 |
| South | 87 % | 0.45 |

&lt;span class="gu"&gt;## Appendix
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What happened on the way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Columns are read column by column.&lt;/strong&gt; The page is split at its whitespace; a channel only separates columns when
there is running text on both sides, so tables, invoices, lists and forms keep their rows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headings get levels&lt;/strong&gt; from their size and weight, ranked across the whole document.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tables keep their cells.&lt;/strong&gt; Tables drawn with rules are found from the lines and cell backgrounds on the page,
tables without rules from the gaps their rows share; cells spanning rows or columns are recognised.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Running heads and page numbers are left out&lt;/strong&gt; – they are recognised by their repetition across pages, by
page-number patterns, or as small outermost lines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hyphenated words are joined&lt;/strong&gt; ("docu- ment" becomes "document"), but "self-employed" keeps its hyphen: the
document's own vocabulary decides. Paragraphs broken by a page or column end are joined again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Markdown is a good intermediate format for language models: headings and tables survive, and it costs far fewer&lt;br&gt;
tokens than HTML.&lt;/p&gt;
&lt;h2&gt;
  
  
  Chunking by section
&lt;/h2&gt;

&lt;p&gt;For retrieval you usually do not want one long Markdown string but chunks that each belong to one section. The layout&lt;br&gt;
analysis behind the export is available directly, so chunking by heading takes a few lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Heading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;heading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StringBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nc"&gt;PdfLayoutAnalyzer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Analyze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Blocks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Kind&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;LayoutBlockKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nc"&gt;LayoutBlockKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Footer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                                         &lt;span class="c1"&gt;// running heads and page numbers&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;LayoutBlockKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Heading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="n"&gt;heading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Clear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;LayoutBlockKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Table&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Cells&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GroupBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AppendLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" | "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AppendLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ReplaceLineEndings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the sample report this gives one chunk under "2 Operations" with both paragraphs and the table rows – the heading&lt;br&gt;
can go into the chunk's metadata or be prepended to the text before embedding. Each block also has its &lt;code&gt;Bounds&lt;/code&gt;, the&lt;br&gt;
page number and its lines with word positions, so an answer can point back to the exact place in the PDF.&lt;/p&gt;

&lt;h2&gt;
  
  
  How well does it work?
&lt;/h2&gt;

&lt;p&gt;Layout analysis is heuristic, so I measured it rather than trusting a few examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reading order across columns:&lt;/strong&gt; on 42 recent arXiv papers that were &lt;em&gt;not&lt;/em&gt; used while developing the column
detection, the word order matches the order of the LaTeX source to 96.9 % on average – reading line by line
gives 84.8 %, PdfPig's layout pipeline 96.1 %. On IRS forms and instructions the median is 98.7 % (line by
line: 50.8 %); for 151 ZUGFeRD and Factur-X invoices the order stays exactly as before, no line item is lost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Block kinds:&lt;/strong&gt; compared with the structure tags of tagged IRS instructions, 89 % of the headings, 88 % of the
list items and 83 % of the paragraphs are recognised.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed:&lt;/strong&gt; about 5 ms per page for the full analysis, including reading the file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same analysis also exports to hOCR, ALTO and PAGE XML, if your pipeline or an archive expects those formats.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;Better to know them before relying on it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No OCR.&lt;/strong&gt; A scanned page without a text layer has no text to analyse; run OCR first (many scanners and OCR tools
add an invisible text layer that miPDFlib reads).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heuristics, not a vision model.&lt;/strong&gt; Magazine layouts with text flowing around images, or tables whose rows are
only separated by alignment, can still come out imperfectly. Models that look at the rendered page are more robust
there – and far more expensive per page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Formulas&lt;/strong&gt; come out as the characters they are drawn with, not as LaTeX.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why not just call Python?
&lt;/h2&gt;

&lt;p&gt;In Python, tools such as Docling or pymupdf4llm do this job, and they are good at it. For a .NET service, though, a&lt;br&gt;
Python sidecar means a second runtime, a second deployment and a process boundary – and PyMuPDF is AGPL or commercial.&lt;br&gt;
miPDFlib runs in-process, has no native dependencies (so it works the same on Windows, Linux and in containers), and is Apache-2.0, so it can go into closed commercial products. The same library also creates, fills,&lt;br&gt;
signs and archives PDFs, which helps when the documents that come out of the pipeline need to go back into a PDF.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package miPDFlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://github.com/Mibuw/miPDFlib/blob/main/docs/guide/text-extraction.md" rel="noopener noreferrer"&gt;text extraction guide&lt;/a&gt; covers the&lt;br&gt;
options (columns, Markdown export settings, letters with fonts and colors, vector paths). If a PDF of yours comes out&lt;br&gt;
wrong, an issue with the file – or a synthetic copy of its layout – is the fastest way to get it fixed.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>pdf</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
