Built for researchers, students, educators, and anyone who thinks better with a pen.
π Get Started β’ β Features β’ π Usage β’ π€ Contribute
- Overview
- Key Features
- Installation
- How to Use
- Architecture & Tech Stack
- Smart Recognition
- Local File System Persistence
- PDF Annotation
- Contributing
- License
- Acknowledgments
ScholarDraw v2 is a next-generation browser extension that transforms any web page or PDF into an interactive canvas. Whether you're reviewing academic papers, taking lecture notes, marking up research articles, or brainstorming ideas β ScholarDraw gives you a powerful, pen-like drawing experience right inside your browser.
| Capability | ScholarDraw v2 | Basic Highlighters |
|---|---|---|
| ποΈ Pressure-aware freehand drawing | β | β |
| π§ AI-driven shape recognition | β | β |
| βοΈ Handwriting-to-text conversion | β | β |
| πΎ Persistent local storage | β | β |
| π Smart DOM anchoring | β | β |
| π Full PDF annotation support | β | β |
| Feature | Description |
|---|---|
| ποΈ Perfect Freehand Engine | Custom stroke-rendering algorithm with simulated pressure, thinning, smoothing, and streamline for natural pen-like strokes |
| π§ Smart Shape Recognition | Draw a rough circle, rectangle, triangle, or arrow β ScholarDraw instantly replaces your sketch with a clean geometric shape using the $1 Unistroke Recognizer |
| βοΈ Handwriting to Text | Scribble words naturally; ScholarDraw sends your strokes to Google Input Tools and replaces them with typed text |
| π§½ Smart Eraser | Hover over or click any stroke to erase it instantly β no undo stack needed |
| π DOM Anchor System | Every drawing is anchored to a stable DOM element. Scroll, resize, or navigate β your annotations stay exactly where they belong |
| πΎ Persistent Local Storage | Choose a local folder once; all your drawings are saved as JSON files per page, forever |
| π PDF Annotation | Automatic redirection of PDF links to an embedded PDF.js viewer with full drawing support |
| ποΈ Stylus & Touch Support | Full pointer event support including pressure-sensitive styluses (Apple Pencil, Surface Pen, etc.) |
| πͺ Glassmorphism UI | Beautiful, draggable floating toolbar with blur effects and smooth animations |
| π¨ Color Palette & Brush Size | 5 preset colors + custom color picker, with adjustable brush width from 2px to 25px |
| ποΈ Minimize & Restore | Hide the toolbar when you need screen space; restore it with one click |
| π Page-Isolated Storage | Each URL gets its own drawing context β no pollution between tabs or pages |
# 1. Clone the repository
git clone https://github.com/eissay/ScholarDraw-v2.git
# 2. Open your Chromium-based browser (Chrome, Edge, Brave, Opera)
# and navigate to: chrome://extensions/
# 3. Enable Developer Mode (toggle in the top-right corner)
# 4. Click "Load unpacked" and select the ScholarDraw-v2 folder
# 5. The ScholarDraw icon will appear in your browser toolbar π| Requirement | Version |
|---|---|
| Chromium-based browser (Chrome, Edge, Brave, Opera) | 88+ |
| File System Access API support | Chrome 86+ |
Click the ScholarDraw icon in your browser toolbar, or click the pencil button on the floating toolbar to enter drawing mode.
- Click and drag anywhere on the page to draw
- Use a stylus for pressure-sensitive strokes
- Adjust brush size and color from the toolbar
Click the magic wand button to enable Smart Mode:
- Draw a circle, rectangle, triangle, or arrow β it becomes a perfect shape
- Scribble text β it converts to typed text automatically
Hover over or click any stroke with the eraser tool active to remove it.
- Click the extension icon in the browser toolbar
- Click "Choose Save Folder" and select a folder on your computer
- All drawings are automatically saved as JSON files β one per page
- Enable PDF Annotator from the extension popup
- Open any PDF link β it automatically opens in ScholarDraw's PDF viewer
- Draw, highlight, and annotate just like on a web page
- Click the minimize button to hide the toolbar
- Click the floating restore button (bottom-right) to bring it back
ScholarDraw-v2/
βββ π manifest.json # Chrome Extension Manifest V3
βββ βοΈ background.js # Service Worker: storage I/O, handwriting API, DNR rules
βββ π¨ content.js # Content Script: drawing engine, UI, DOM anchoring
βββ π₯οΈ popup.html / popup.js # Extension popup: settings & folder management
βββ π viewer.html / viewer.js / viewer.css # PDF.js custom viewer
βββ π pdfjs/ # PDF.js library (Mozilla)
βββ π README.md
| Component | Technology |
|---|---|
| Extension Framework | Chrome Extension Manifest V3 |
| Drawing Engine | Custom SVG-based renderer with Perfect Freehand algorithm |
| Shape Recognition | $1 Unistroke Recognizer (64-point resampling, Golden Section Search) |
| Handwriting OCR | Google Input Tools Handwriting API |
| PDF Rendering | Mozilla PDF.js |
| Storage | File System Access API + IndexedDB (handle persistence) |
| UI Styling | Vanilla CSS with Glassmorphism (backdrop-filter) |
| DOM Interaction | Shadow DOM, MutationObserver, ResizeObserver |
ScholarDraw v2 includes two AI-powered recognition engines:
Based on the classic $1 Unistroke Recognizer by Wobbrock et al., ScholarDraw recognizes:
| Sketch | Result | SVG Output |
|---|---|---|
| Rough circle | β‘οΈ | Perfect circle SVG |
| Rough rectangle | β‘οΈ | Clean rect SVG |
| Rough triangle | β‘οΈ | Precise polygon SVG |
| Rough arrow | β‘οΈ | Straight line with arrowhead SVG |
Recognition threshold:
82%confidence
Using Google Input Tools handwriting recognition, ScholarDraw converts your scribbles into typed text with automatic font sizing based on your writing area.
ScholarDraw uses the File System Access API to save your drawings directly to a folder of your choice:
- βοΈ No cloud required β everything stays on your machine
- π Per-page isolation β each URL gets a unique context ID and its own
.jsonfile - π Automatic sync β drawings save 1.2 seconds after you stop drawing
- πΎ IndexedDB backup β the folder handle is persisted across browser sessions
<domain>_<path>_<query_params>.json
Example:
github_com_eissay_ScholarDraw-v2.json
ScholarDraw intercepts PDF links using the Declarative Net Request API and redirects them to a custom PDF.js viewer with full annotation support:
- β
Works on
http://,https://, andfile://PDFs - β Toggle on/off from the extension popup
- β All PDF annotations are saved just like web page annotations
Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements.
# 1. Fork the repository
# 2. Create a feature branch
git checkout -b feature/amazing-feature
# 3. Commit your changes
git commit -m 'Add amazing feature'
# 4. Push to the branch
git push origin feature/amazing-feature
# 5. Open a Pull Request ππ‘ Please ensure your code follows the existing style and includes comments for complex logic.
This project is licensed under the MIT License β see the LICENSE file for details.
| Project | Contribution |
|---|---|
| Perfect Freehand | Stroke rendering algorithm inspiration |
| $1 Unistroke Recognizer | Geometric gesture recognition |
| Mozilla PDF.js | PDF rendering engine |
| Google Input Tools | Handwriting recognition API |
| Lucide Icons | Toolbar iconography (SVG) |