An AI-powered PDF study tool built with Next.js. Upload PDFs, select content, get instant AI explanations, and track your progress with annotations.
- 📄 PDF Viewer - Upload and view PDFs with zoom controls
- 🔍 Smart Selection - Select text or Ctrl+drag for region selection
- 🤖 AI Analysis - Get explanations, summaries, and calculations
- 📝 Annotations - Mark sections as Complete/Incomplete/Pending
- 💾 Persistence - PDFs and annotations saved locally
- 📚 Library - Manage all your uploaded PDFs
- 🎨 Modern UI - Beautiful dark theme with animations
- Go to OpenRouter
- Sign up (free)
- Create an API key
cd pdf-viewer
npm install
# Create .env.local with your API key
echo "OPENROUTER_API_KEY=your-key-here" > .env.local
npm run dev- Upload PDFs via drag & drop
- Set status: Complete ✓ / Incomplete ✗ / In Progress ◐
- Click to open in viewer
- Text Selection: Click and drag to select text
- Region Selection: Hold Ctrl + drag to select any area
- AI Actions: Click Explain, Summarize, or Calculate
- Annotations: Mark regions with status overlays
- Ctrl+drag to select a region
- Click Complete/Pending/Incomplete/Note
- Colored overlay appears on PDF
- Filter annotations using dropdown
- View all in sidebar panel
| Technology | Purpose |
|---|---|
| Next.js 16 | React framework |
| react-pdf | PDF rendering |
| OpenRouter | AI API gateway |
| Gemini Flash | Vision-capable AI |
| Tailwind CSS | Styling |
| Framer Motion | Animations |
| JSON Storage | Local persistence |
pdf-viewer/
├── src/
│ ├── app/
│ │ ├── page.tsx # Landing page
│ │ ├── viewer/page.tsx # PDF Viewer
│ │ ├── library/page.tsx # PDF Library
│ │ └── api/pdfs/ # REST API
│ ├── components/
│ │ ├── PDFViewer.tsx # PDF + annotations
│ │ ├── GeminiChat.tsx # AI chat
│ │ └── SelectionToolbar.tsx
│ └── lib/
│ ├── db.ts # JSON storage
│ └── gemini.ts # AI client
├── data/
│ └── pdfs.json # Local database
└── .env.local # API key
| Variable | Description |
|---|---|
OPENROUTER_API_KEY |
Your OpenRouter API key |
| Endpoint | Method | Description |
|---|---|---|
/api/pdfs |
GET | List all PDFs |
/api/pdfs |
POST | Upload PDF |
/api/pdfs/[id] |
GET | Get PDF by ID |
/api/pdfs/[id] |
DELETE | Delete PDF |
/api/pdfs/[id] |
PATCH | Update status |
MIT License
© 2026 PDF Selection Viewer