Overview
Extract and save figures/tables from PDFs for easy reference and citation.
Why
Scientists often need to reference specific figures. "Figure 3 shows..." should link to the actual figure.
Plan
1. Create Figure Model
// Model/Figure.swift
struct Figure: Codable, Identifiable {
let id: String
let paperId: String
let pageNumber: Int
let bounds: CGRect
let imageData: Data // PNG snapshot
var caption: String?
var label: String? // "Figure 3", "Table 2"
var linkedNoteIds: [String]
let extractedAt: Date
}
2. Extraction Methods
- Manual: User draws rectangle on PDF → extract region
- Semi-auto: Detect image regions on page
- Caption parsing: Find "Figure X:" patterns
3. FigureService
- Extract region from PDF page as image
- OCR caption (Vision framework)
- Store images in
~/.pdfscribe/figures/
4. UI Components
- Figure extraction mode (toolbar toggle)
- Draw rectangle → confirm → add caption
- Figure gallery per paper
- Thumbnail previews
5. Integration
- Link figures in notes:
[[figure:id]]
- Insert figure in note (embedded image)
- Copy figure to clipboard
Acceptance Criteria
Overview
Extract and save figures/tables from PDFs for easy reference and citation.
Why
Scientists often need to reference specific figures. "Figure 3 shows..." should link to the actual figure.
Plan
1. Create Figure Model
2. Extraction Methods
3. FigureService
~/.pdfscribe/figures/4. UI Components
5. Integration
[[figure:id]]Acceptance Criteria