AI features in WebViewer
WebViewer has a growing set of AI-powered features to enhance PDF interactions. These features leverage LLMs to extract insights from PDFs and present them in user-friendly ways. The first of these features is Source Locator, which maps LLM answers back to exact PDF coordinates for highlighting.Source Locator
LLMs are good at answering questions from PDF content. But showing users exactly where that answer came from in the original is a different problem. Enterprise workflows (legal, finance, research) need source verification: Users can’t always just trust the answer, they need to see it in the context of the document they are working with. Source Locator is a WebViewer feature that takes LLM-generated answers (with quoted Markdown source text) and maps them back to precise PDF coordinates for highlighting. It uses internal library methods with no additional LLM calls and no token cost.Flow
PDF → Markdown → LLM answer with source text (MD input) → Source Locator → PDF highlight
The MD input is expected to be high-quality text from an LLM response, not human-typed queries with misspellings.
User Requirements
- User must prompt LLM to return source text (quoted passage) in responses
- Compatible with any Markdown extraction tool, e.g. PyMuPDF4LLM
Example
The following example uses thetext.locateSource() method to find the coordinates of the source text in the PDF, highlights it and scrolls the viewer to the page where the text is located.
Note, the Markdown text in this example is a simple heading and list, but the method can handle more complex Markdown as well such as table syntax.