Every “chat with your PDF” tutorial works on the tutorial author’s PDF. Yours will include a scanned contract with no text layer, a two-column report whose lines interleave when extracted, a spreadsheet exported to PDF where the numbers arrive without their headers, and a four-hundred-page manual where the answer is on page 312. Those are four different problems and only one of them is about the model.

A PDF is not a document format

A PDF describes where to paint glyphs on a page. There is no paragraph, no reading order, no table and often no space character — extractors reconstruct all of that from coordinates. Everything difficult below follows from that one fact.

The practical consequence: extraction is a guess, and your pipeline should treat it as one. Log what it produced, keep the page number, and make it possible for a human to look at the original page when an answer looks wrong.

Sort your PDFs before you parse them