scambier/obsidian-text-extractor

A (companion) plugin to facilitate the extraction of text from images (OCR) and PDFs.

Obsidian Text Extractor – what it is

A community‑made Obsidian plugin that lets you pull the plain‑text content out of files that normally contain only images or scanned pages – PNG/JPG/… images, PDF documents and Office files (DOCX, XLSX). It works by calling the open‑source OCR engine Tesseract.js (and a PDF‑parsing helper) directly in the browser, then caches the result so other plugins (e.g., Omnisearch) can reuse it.

Why it matters

  • Searchable notes – Obsidian’s built‑in search can’t see text that lives inside pictures or scanned PDFs. This plugin makes that hidden text visible to the vault’s index and to any other plugin that needs it.
  • Single source of truth – Instead of each plugin implementing its own OCR pipeline, they can all call the same API, saving memory and CPU.
  • Local processing – The OCR runs in the user’s browser; no data is sent to a remote server (the only network traffic is downloading language packs for Tesseract on first use).

How it works (high‑level)

  1. User triggers extraction – via a context‑menu entry on a supported file.
  2. File type detection – the plugin checks the extension (.png, .pdf, .docx, …) and decides whether it can be processed.
  3. OCR / parsing
    • Images → Tesseract.js (WebAssembly‑based OCR).
    • PDFs → pdf-extract library, which extracts embedded text or falls back to OCR on each page.
  4. Caching – The resulting string is saved as a tiny .json file inside the plugin folder. Subsequent calls return the cached version instantly and can be synced across devices.
  5. API exposure – Other plugins can call extractText(file) or query isInCache(file) through the exported TextExtractorApi.

Key limitations (as stated in the README)

  • PDF extraction is flaky – many PDFs fail to yield text; the issue tracker has several open bugs.
  • No mobile support – OCR libraries don’t run on Obsidian’s mobile app, so the plugin returns an empty string unless a cached copy exists.
  • Internet required for first run – language data for Tesseract is downloaded on demand.
  • Unmaintained – the author has stepped back; contributions are welcome but no active development is guaranteed.

Getting started

  1. Install via the Obsidian Community Plugins browser, or download the latest release from GitHub.
  2. Open a note, right‑click a supported file, and choose Extract Text.
  3. The extracted text appears in the cache and can be accessed by other plugins (e.g., Omnisearch) or via the API shown in the README.

For developers

export type TextExtractorApi = {
  extractText: (file: TFile) => Promise<string>
  canFileBeExtracted: (filePath: string) => boolean
  isInCache: (file: TFile) => Promise<boolean>
}

export function getTextExtractor(): TextExtractorApi | undefined {
  return (app as any).plugins?.plugins?.['text-extractor']?.api
}

Use the above to call await getTextExtractor()?.extractText(myFile) from any other Obsidian plugin.


Bottom line: Obsidian Text Extractor is a practical, locally‑run OCR helper for the Obsidian note‑taking ecosystem. It isn’t a research‑grade AI model, but it leverages existing ML‑based OCR technology to make image‑based notes searchable and reusable.

Related

  • Project
  • Project
  • Project
  • Project