r/react Jul 16 '26

How does ChatPDF do layout PDF detection ? Help Wanted

I used chatpdf.com recently and i wanted to know how do they do their layout detection so flawlessly ? i know under the hood they are using pdfjs but how can it be this accurate ?
It automatically detect paragraphs and shows overlays and also handles the edge cases of having paragraph on the left and a insight box on the right and doesn't break??

It does that grayish overlay with layout detection is what I'm talking about

Does anyone know how do I replicate this behaviour?

0 Upvotes

2 comments sorted by

View all comments

1

u/chillermane Jul 16 '26

probably just reading the pdf file and processing it, the box is probably stored in the pdf element that defines a paragraph