PDF Annotations to AI and RAG: Export Highlights for LLMs
To export PDF annotations for AI and RAG workflows, import your PDF (or XFDF/XML FDF) into pdfannotations.com and choose either AI Context Markdown — a structured format designed for pasting into ChatGPT, Claude, or Gemini — or RAG JSON — a schema-ready payload for embedding into a vector database. Both formats run in your browser without a file upload and include available metadata—page, color, author, date, and tags—so an LLM or retrieval pipeline can ground answers in your source material.
This guide walks through both export formats, explains when to use each, and shows you how to wire the output into a ChatGPT conversation, a LangChain retrieval pipeline, or a custom vector database.
Why Feed PDF Annotations to an LLM?
Reading a PDF is one thing; doing something useful with the highlights is another. Most knowledge workers stop at "highlighted the important parts" and never revisit them. Feeding annotations into an LLM changes that:
- Synthesis. Ask an LLM to summarize 200 highlights into a 3-paragraph brief.
- Cross-referencing. Ask "which of these highlights contradict each other?" and use the page references to check the answer.
- Drafting. Use highlights as the raw material for a literature review, a memo, or an email summary.
- Question answering. Build a RAG pipeline that lets you ask natural-language questions of your highlights ("what did the author say about construct validity on page 12?").
- Translation and tone shift. Ask the LLM to rewrite academic highlights as plain-English explanations for a non-specialist audience.
The catch is that LLMs need structure. Pasting 200 raw highlights into a chat box produces an unstructured blob that the model struggles to cite accurately. That is why pdfannotations.com provides two purpose-built Pro export formats.
Format 1: AI Context Markdown
AI Context Markdown is a structured Markdown format designed specifically for pasting into a chat conversation. The structure gives the LLM explicit anchors it can reference when answering, which dramatically improves citation accuracy and reduces hallucination.
Structure
# Source: research-paper.pdf
Author: Jane Doe
Pages: 32
Exported: 2026-07-22
## Page 12
### Highlight
> The most reliable predictor of long-term success is consistent practice over time.
### Context
Discussion of the role of deliberate practice in skill acquisition.
### My Note
This connects to the Ericsson framework I read last week.
### Tags
#key-concept #practice #skill-acquisition
## Page 15
### Highlight
> Sample size was limited to 30 participants, which constrains generalizability.
### Context
Limitations section.
### My Note
Flag for follow-up — need to check if a replication exists.
### Tags
#limitation #methodology
The hierarchy is:
# Source— top-level heading naming the source file, with author, page count, and export date as metadata## Page N— one section per page that contains annotations### Highlight— the verbatim text you highlighted in the PDF### Context— a one-line description of where the highlight appears in the document (section, paragraph position)### My Note— your own comment or sticky note attached to the highlight### Tags— the color category and any custom tags you assigned
This structure matters because it gives the LLM:
- Anchors. Every highlight is wrapped in a
### Highlightheading the model can cite ("According to the highlight on Page 12..."). - Provenance. Page numbers and source filenames mean the model can tell you where a claim came from, not just that it was claimed.
- Your interpretation. The
### My Notefield is your own commentary, which the model can use to understand what you found important about a highlight. - Filterable tags. Tags let you ask "summarize every highlight tagged
#limitation" and get a focused answer.
How to Use AI Context Markdown
- Export your annotations from pdfannotations.com using the AI Context format.
- Open the resulting
.mdfile in any text editor and copy the contents. - Paste into a new chat in ChatGPT, Claude, or Gemini.
- Prepend a prompt like: "Here are my highlights from a research paper. Summarize the main argument in three sentences, then list the three highlights I tagged as
#key-concept."
Because the format is plain Markdown, every model handles it identically. No special plugins, no API calls, no vector database required.
When to Use AI Context Markdown
- You want a one-shot conversation with an LLM about a single document's highlights
- You need the model to cite specific pages and tags
- You are doing exploratory analysis and want to iterate on prompts
- You do not want to set up a vector database or embedding pipeline
Format 2: RAG-Ready JSON
RAG JSON is a structured JSON payload designed for ingestion into a vector database. Each annotation becomes a discrete record with its own text and metadata, so an embedding pipeline can chunk, embed, and retrieve individual highlights rather than treating the whole document as one blob.
Structure
[
{
"text": "The most reliable predictor of long-term success is consistent practice over time.",
"metadata": {
"source": "research-paper.pdf",
"page": 12,
"type": "highlight",
"author": "Jane Doe",
"date": "2026-07-20T12:00:00Z",
"color": "#FFEB3B",
"tags": ["key-concept", "practice", "skill-acquisition"],
"note": "This connects to the Ericsson framework I read last week."
}
},
{
"text": "Sample size was limited to 30 participants, which constrains generalizability.",
"metadata": {
"source": "research-paper.pdf",
"page": 15,
"type": "highlight",
"author": "Jane Doe",
"date": "2026-07-20T12:10:00Z",
"color": "#F44336",
"tags": ["limitation", "methodology"],
"note": "Flag for follow-up — need to check if a replication exists."
}
}
]
Each record has two fields:
text— the highlight content, ready to be embeddedmetadata— a structured object containing:source— filename of the source PDF/XFDFpage— page number where the highlight livestype—highlight,note,underline,strikeout, orfreetextauthor— whoever created the annotation in Acrobatdate— ISO 8601 timestamp of annotation creationcolor— RGB hex value of the markuptags— array of tags (color category + any custom tags)note— your own comment text, if any
This structure is the standard format that vector databases like Pinecone, Weaviate, Chroma, Qdrant, and pgvector expect: a text field for embedding, and a metadata field for filtering during retrieval.
How to Ingest RAG JSON into a Vector Database
The exact code depends on your stack, but the pattern is the same everywhere:
- Embed each
textfield using your preferred embedding model (OpenAItext-embedding-3-small, Cohere, Voyage, or a local model via sentence-transformers). - Store the embedding in your vector database, with the
metadataobject attached as filterable fields. - At query time, embed the user's question, retrieve the top-k nearest highlights, and pass them to an LLM as context.
Here is a minimal example using Python with the OpenAI client and a generic vector store:
import json
import openai
client = openai.OpenAI()
with open("annotations_rag.json") as f:
records = json.load(f)
vectors = []
for record in records:
embedding = client.embeddings.create(
input=record["text"],
model="text-embedding-3-small"
).data[0].embedding
vectors.append({
"id": f"{record['metadata']['source']}-p{record['metadata']['page']}-{record['metadata']['type']}",
"values": embedding,
"metadata": record["metadata"],
"text": record["text"]
})
# Upsert `vectors` into your vector store of choice
# (Pinecone, Weaviate, Chroma, Qdrant, pgvector, etc.)
Once ingested, you can ask natural-language questions and retrieve the specific highlights that answer them — with full provenance (source, page, author, color, tags) attached to every result.
When to Use RAG JSON
- You have many documents and want to query across all of them at once
- You want to retrieve highlights by metadata ("show me every
#limitationfrom papers by Jane Doe") - You are building a production-grade Q&A system or chatbot over your annotations
- You want to combine highlights with other knowledge sources (web pages, internal docs, code) in a single retrieval index
Pasting into ChatGPT, Claude, and Gemini
For ad-hoc analysis without setting up a vector database, the AI Context Markdown format is the fastest path. Here is how to use it with each major model.
ChatGPT
- Start a new conversation in ChatGPT (GPT-4o or newer recommended for longer context).
- Paste the AI Context Markdown content as your first message.
- Add your prompt: "Below are my highlights from a research paper, structured by page. Summarize the main argument, then list the three highlights I tagged
#key-conceptwith their page numbers."
ChatGPT handles Markdown natively, so the ### Highlight headings and > blockquotes render correctly and the model can cite pages accurately.
Claude
Claude (especially Claude 3.5 Sonnet and Claude 4) is particularly strong at structured reasoning over long documents. Paste the AI Context Markdown and ask for synthesis:
"Here are highlights from a paper, structured by page. Identify the three strongest arguments and the three weakest, citing the page number for each."
Claude's larger context window (200K tokens) means you can paste highlights from multiple papers in a single conversation.
Gemini
Gemini handles Markdown well and integrates with Google Workspace, so it is a good choice if you want to push the LLM's output into a Google Doc or Sheet. Paste the AI Context Markdown and prompt:
"Here are my PDF highlights, structured by page. Create a Google Sheets-ready table with columns: Page, Highlight, My Note, Tags."
Tips for Better LLM Output
- Always ask for page citations. Because the AI Context format embeds page numbers in headings, asking "cite the page number for each claim" gives the model a clear anchor and reduces hallucination.
- Use tags as filters. Prompt with "only consider highlights tagged
#limitation" to focus the model on a subset of your annotations. - Provide your own notes. The
### My Notefield is your interpretation. If you want the model to reason about why you highlighted something, explicitly ask it to consider your notes. - Chunk large exports. If you have 500+ highlights, split the export into multiple files (one per source document) and process them in separate conversations. This keeps each conversation focused and prevents context-window overflow.
Real-World Use Cases
Academic Literature Review
A PhD student reading 50 papers on educational measurement exports highlights from each as AI Context Markdown. They paste all 50 into a single Claude conversation and ask: "Across these 50 papers, what are the three most-cited limitations of construct validity studies, and which authors raised each one?"
Claude returns a synthesis with page citations, which the student pastes directly into the literature review section of their thesis. The same student exports the same highlights as RAG JSON, ingests them into a Pinecone index, and builds a Slack bot that answers "what did paper X say about Y?" questions from their lab mates.
Legal Contract Analysis
A lawyer reviewing a 200-page merger agreement highlights every indemnification clause in red and every termination trigger in yellow. They export as AI Context Markdown and ask ChatGPT: "List every indemnification clause with a cap below $1M, with page numbers." The structured format means ChatGPT can cite pages accurately, which the lawyer uses to draft a redline.
For ongoing matters, the same highlights go into a RAG JSON pipeline, ingested into the firm's internal Qdrant instance. Paralegals can then ask "what does Section 7.3 say about survival periods?" and retrieve the specific highlight plus its page number.
Technical Documentation Knowledge Base
An engineering team migrating a legacy system exports highlights from 30 architecture PDFs as RAG JSON. Each highlight becomes a vector in their Chroma index. When a new engineer asks "where do we document the authentication flow?", the retrieval pipeline returns the relevant highlights with page numbers, source filenames, and the original highlighter's notes — without anyone having to remember which PDF the answer lives in.
The same team uses AI Context Markdown to generate weekly summaries: paste the week's new highlights into Claude, ask for a one-page brief, and ship it to the team Slack.
Choosing Between AI Context and RAG JSON
| Question | AI Context Markdown | RAG JSON |
|---|---|---|
| One-shot chat analysis? | ✅ | — |
| Production Q&A system? | — | ✅ |
| No code, no setup? | ✅ | — |
| Cross-document retrieval? | — | ✅ |
| Metadata filtering at query time? | Limited | ✅ |
| Works with any LLM? | ✅ | ✅ (with retrieval layer) |
| Token-efficient for chat? | ✅ | — |
| Scales to thousands of highlights? | — | ✅ |
A reasonable rule of thumb: start with AI Context Markdown for exploration, graduate to RAG JSON when you need to scale. Most users begin with a chat-based workflow, discover what kinds of questions they actually ask, then build a RAG pipeline once the questions become repetitive.
Why Local Processing Matters for AI Exports
LLM providers log conversations by default. If you paste confidential research, legal contracts, or proprietary documents into ChatGPT, that content may be retained and used for model training (depending on your account tier and settings). The annotations themselves are the most sensitive part of a document — they reveal which passages you considered important, which you disagreed with, and which you flagged for follow-up.
A browser-based export workflow does not eliminate this concern—you still paste highlights into the LLM—but it does provide these controls:
- The conversion step happens locally. Your PDF or XFDF is not sent to a server during annotation extraction.
- You control what gets pasted. You can review the AI Context Markdown before sending it, redacting anything sensitive.
- The RAG JSON pipeline is yours. With a self-hosted vector database and local embedding model, data can remain in your infrastructure; third-party embedding APIs follow their provider policies.
For the conversion itself, pdfannotations.com runs entirely in your browser. Disconnect your internet after the page loads — the export still works.
Frequently Asked Questions
What is the difference between AI Context Markdown and regular Markdown?
AI Context Markdown uses a specific heading hierarchy (# Source → ## Page → ### Highlight / ### Context / ### My Note / ### Tags) that gives LLMs explicit anchors to cite. Regular Markdown export is flatter and optimized for human reading in a note-taking app, not for LLM ingestion.
Can I use RAG JSON without a vector database?
Yes, but you lose the retrieval benefits. You can load RAG JSON into a Python script, filter records by metadata (e.g. page == 12), and feed only the matching highlights into an LLM. This is a poor man's RAG pipeline and works fine for small annotation sets.
Which embedding model should I use for RAG JSON?
For English-language highlights, OpenAI's text-embedding-3-small is often an economical starting point. Evaluate it against your own data and language. For multilingual content, consider Cohere's embed-multilingual-v3 or a local sentence-transformers model. For legal or technical content, test Voyage AI's voyage-law-2 or voyage-code-2 against general-purpose models.
How many highlights can I paste into a single LLM conversation?
It depends on the model and service. GPT-4o commonly supports 128K tokens and Claude 3.5 Sonnet commonly supports 200K, but context limits can change and do not translate directly into page counts. For large sets, split conversations or use a RAG JSON pipeline.
Does the export preserve my comment text?
Yes, when the comment is stored in the annotation. AI Context Markdown uses ### My Note; RAG JSON uses metadata.note.
Related Guides
Want to learn more? Check out these related guides:
- PDF to Markdown Best Practices - Clean annotation-export patterns that produce LLM-ready Markdown
- How to Export XFDF Annotations from Adobe Acrobat - Get XFDF out of Acrobat as the input for AI export
- What Is XFDF? PDF Annotation XML Format Explained - Deep dive into the XFDF file format and its XML structure
- XFDF to Obsidian: Convert Adobe PDF Annotations to Markdown - Pair AI export with an Obsidian vault for a complete knowledge pipeline
- Export PDF Highlights to Obsidian: Complete Workflow Guide - The full Obsidian workflow for PDFs with standard annotations
Try the annotation extraction tool
Open an annotated PDF and export annotations locally. Markdown, CSV, and plain text are free.
Extract PDF Annotations →