Skip to content

Figure & Table Extraction #115

@huypham37

Description

@huypham37

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

  • Extract region from PDF as image
  • Save with caption/label
  • View all figures for a paper
  • Link figures in notes
  • Copy figure to clipboard

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestimportantProductivity enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions