Alexis Rondeau

Archive

December 2020 · 5 dispatches

obsidian-extract-pdf-highlights

Extract highlights, underlines and annotations from your PDFs into Obsidian

243 stars · 17 forks · TypeScript

Extract your PDF text-highlights into Obsidian

This plugin allows you to extract highlighted and underlined text from your PDFs into a markdown file in your Obsidian vault.

How it works

After you’ve installed and activated the plugin:

  1. Drop your highlighted PDF into your Obsidian vault
  2. Open the PDF in Obsidian
  3. Click the “PDF” icon in the left sidebar

Demo with default settings

Simple

Demo with all optional settings turned on

Settings

Optional settings

  • Include page number (Default: off)
  • Include highlight color (Default: off)
  • Create links (Default: off)

Backlog

The list of features and improvements for this plugin.

ICEBOX

  • Record demo video, quick-start walk-through for new users

TODO

  • Auto-create notes from links with highlight/annotation as quote with backlink to source PDF
  • Group highlights by highlight color (Optional)
  • Add progress bar/modal to show “Processed Page 5/10 (50%)” or similar for longer PDFs
  • Fix missing space after newline (Very complex)

DOING

…

DONE

  • Refactor pdfjs import to not overload Obsidian worker (Ideas from @lishid?)
  • Show highlight color (Optional)
  • Auto-link list items (Optional)
  • Refactor/extract PDF from main.ts
  • Add Page-number to each highlight (Optional)
  • Sort highlights by position in document and page (Mandatory)
  • Extract unsorted list of HIGHLIGHT annotations
  • Extract unsorted list of TEXT annotations
  • Extract unsorted list of UNDERLINE annotations
  • Decide if to integrate with existing Highlights Plugin

Contribute

I’d love to hear from you, so please check out the Contribution page to get in touch!

Major Thanks

This plugin stands on the shoulders of Joseph Devietti and his 2012 pull-request for PDFJS.

Extract PDF Highlights

I was tired of re-typing the passages I’d highlighted while reading. Now you open a marked-up PDF in Obsidian, click once, and every highlight, underline and note lands in a tidy page-ordered note you can actually search, link and build on. Hours of manual copying gone — your reading turns straight into usable notes.

Open →

obsidian-extract-pdf

Extract PDFs to Markdown within Obsidian

270 stars · 24 forks · JavaScript

Extract PDF text to Markdown

Allows you to extract the basic textual content of a PDF into a Markdown file. Works well with headings, paragraphs and lists.

Demo

How to use this plugin

After you’ve installed and activated the plugin:

  1. Drag your PDF into Obsidian
  2. Open the PDF within Obsidian
  3. Make sure the pane with your PDF is focused
  4. Click the “PDF to Markdown” button in the sidebar
  5. Edit the generated markdown file to your needs

Tips & Tricks for editing the generated markdown file

I just went ahead and turned a 500 page PDF into markdown and found that it worked better and faster than I expected.

Bulk-removing page footers

The book I used had the same footer on every page. That means they got copied into the markdown file over and over, too.

For bulk search-and-replace I use the Atom editor (https://atom.io):

  1. Copy the footer text into your clipboard
  2. Download and install Atom
  3. Open Atom and open the Markdown file inside
  4. Use “Find -> Find in Buffer” and paste the footer text
  5. Use the button “Replace” or “Replace All” to remove footer text

Remove a single space before a new line of text

Weirdly, sometimes, new lines of text had a space infront of them. Such as:

Some text

…which resulted in Obisidian treating it as a sub-block of the preceding line.

To remove the space for those lines, I used a regular expression search-and-replace:

  1. In “Find in current buffer” activate “Regex Search” (The .* icon)
  2. Enter ^([ ]|\t)+ into the search field
  3. Use the button “Replace” or “Replace All” to remove the space

Known issues

First-time use

If you had a PDF open in Obisidian before you installed and activated the plugin, hitting the button may not work. I’ve had this issue with other plugins as well. The code just doesn’t hook up to already-open files.

The solution is to simply close the PDF note and re-open it. That will allow the plugin to hook into it.

Limited PDF parsing

Please understand that this is a basic, best-effort tool to get basic text and headings from a PDF. It really just gets the text from a pdf and turns it into Markdown. The plugin doesn’t handle anything more complex, like tables, images, annotations etc:

  • Does not turn PDF highlights and annotations into MD highlights
  • Does not retain PDF numbered lists
  • Does not skip text in headers and footers

Extract PDF

This one frees the text trapped inside a PDF. One click turns a document into clean, editable notes — headings, paragraphs and lists intact — so you can quote it, rework it, and weave it into your own writing instead of squinting at a locked-up file.

Open →