Back to blog

Feb 20, 2025

Ninjadoc vs PDF.ai: Why Embeddings Can't See Your Documents

In this article, you'll learn why "Chat with PDF" tools often fail on complex business documents, and how Vision AI solves the problem. Code samples demonstrate both approaches.

Summary:

  • Traditional RAG tools convert PDFs to text, stripping away vital visual context like signatures, checkboxes, and layout.
  • Vision AI processes documents as images, preserving the 2D spatial relationships that text extraction destroys.
  • For complex business documents—invoices, forms, contracts—Vision AI provides the accuracy that embeddings cannot match.

What is RAG?

RAG, or Retrieval Augmented Generation, powers most "Chat with PDF" tools like PDF.ai. The process begins by extracting text from a document using standard OCR or PDF parsing. This raw text is then split into smaller chunks and converted into vector embeddings. When a user asks a question, the system searches for the most relevant text chunks and feeds them to a Large Language Model (LLM) to generate an answer. This method works exceptionally well for text-heavy documents like research papers, essays, and books where the information is purely semantic and linear. However, this text-centric approach falters when the document's meaning relies on its visual presentation.

The Data Loss Problem

Converting a document to text is a lossy transformation that flattens a rich 2D spatial layout into a 1D stream of characters. In this process, critical visual information evaporates. Signatures become invisible because they are ink marks, not characters. Checkboxes lose their state, as OCR often fails to distinguish between a checked and unchecked box. Tables and multi-column layouts are frequently mangled, causing row and column alignments to disappear. Even handwriting can be misinterpreted as garbage characters. Most importantly, spatial relationships—knowing that "Total" is visually aligned with "$500"—are lost, creating ambiguity that no amount of prompt engineering can fix.

What RAG Misses

In production environments, this "text-only" limitation leads to specific, repeatable failures.

The Signature Blind Spot

Consider a scenario where you need to verify a signed contract. A RAG-based system might see a signature as a random scribble or ignore it entirely, leading it to confidently declare the document unsigned. In contrast, Vision AI looks at the signature field, identifies the ink, and confirms the signature's presence with precise bounding boxes.

The Multi-Column Trap

Similarly, in multi-column invoices, text extraction often reads left-to-right across columns, mashing descriptions and prices together. Vision AI perceives the grid structure, correctly associating line items with their corresponding costs based on visual alignment.

The Vision AI Approach

Vision AI fundamentally differs by skipping the text extraction step entirely. Instead, it feeds the document image directly to a Vision-Language Model (VLM). This allows the model to "see" the document exactly as a human would, preserving the full 2D spatial context. Labels remain visually connected to their values, and visual marks like stamps, signatures, and checkboxes are clearly recognized. The model reads handwriting by analyzing pixels rather than relying on potentially flawed OCR output. While Vision models are more compute-intensive than simple embeddings, the dramatic increase in accuracy for complex business documents justifies the investment by eliminating the need for manual human review.

Code Comparison

The difference in implementation highlights the contrast in complexity.

RAG Pipeline (PDF.ai style)

You must manage a complex pipeline of text extraction, chunking, embedding, and retrieval:

# The "Blind" Pipeline
text = ocr_lib.extract_text(pdf)
chunks = splitter.split(text)
vectors = embedding_model.embed(chunks)
# ... search vectors ...
# ... feed to LLM ...

# Result: "I cannot find a signature in the text provided."

Vision AI Pipeline (Ninjadoc)

A single API call allows the model to see and understand the document:

const formData = new FormData();
formData.append('document', file);
formData.append('question', 'Is this document signed?');

const response = await fetch('https://ninjadoc.ai/api/ask', {
  method: 'POST',
  headers: { 'X-API-Key': 'YOUR_API_KEY' },
  body: formData
});

const result = await response.json();
// { answer: "Yes", bbox: [100, 200, 300, 400] }

When to Use Which

Choosing the right tool depends on your specific document types. RAG and tools like PDF.ai are excellent for summarizing long, text-heavy content such as essays, reports, or books where layout is secondary. However, for processing forms, invoices, receipts, or contracts, Vision AI is the superior choice. It is the only reliable option when you need to verify signatures, check box states, read handwriting, or require coordinate-level proof for audit trails. When accuracy is paramount, Vision AI delivers the results that text-based embeddings simply cannot.

Conclusion

The choice between RAG and Vision AI comes down to the nature of your documents. If you are dealing with unstructured text like emails or reports, standard embeddings are fast and effective. But for the structured, visual world of business documents—where a signature, a checkbox, or a column alignment changes the meaning of the entire page—Vision AI is not just an upgrade; it is a necessity. By treating documents as images, Ninjadoc ensures that no data is lost in translation, providing the reliability required for automated workflows.

Frequently Asked Questions

Why can't PDF.ai detect signatures?

PDF.ai extracts text from documents. A signature is a visual mark (ink), not a text character. If the OCR layer doesn't convert the scribble into text—which it shouldn't—the embedding model literally cannot see it.

Doesn't GPT-4o support vision?

Yes, but most 'Chat with PDF' tools don't use vision capabilities for the entire document due to cost and context limits. They use RAG on extracted text. Ninjadoc is built from the ground up as a Vision-first platform.

Can I use Ninjadoc for summarizing long essays?

You can, but that's where RAG tools like PDF.ai excel. If you have 100 pages of pure text, embeddings are efficient. If you have 5 pages of complex forms, invoices, or scanned contracts, Vision AI is superior.

How does Ninjadoc handle handwriting?

We use Vision-Language Models that 'read' handwriting like a human—by looking at the pixels. Traditional OCR often produces garbage characters for messy handwriting.

Further Reading

See What Embeddings Miss

Upload a complex form or signed contract and experience the difference. Get started with free credits—no credit card required.