slumos / org-pdftools

A custom org link type for pdf-tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

org-pdftools: a custom org link type for pdf-tools

This project was inspired by and built upon org-pdfview from @markus1189.

Installation

You can now install org-pdftools and org-noter-pdftools from MELPA!

https://melpa.org/packages/org-pdftools-badge.svg

https://melpa.org/packages/org-noter-pdftools-badge.svg

Usage

(use-package org-pdftools
  :hook (org-load . org-pdftools-setup-link))

(use-package org-noter-pdftools
  :after org-noter
  :config
  (with-eval-after-load 'pdf-annot
    (add-hook 'pdf-annot-activate-handler-functions #'org-noter-pdftools-jump-to-note)))

Latest release note

  • HTML exported link now have a “#page=n” postfix, which should make browsers like Chrome open the corresponding page.
  • You can now customize the link description format using org-pdftools-get-desc-function
  • Added org-noter-pdftools-embed-org-note-to-pdf, org-noter-pdftools-embed-all-org-note-to-pdf to copy one or all org-noter annotation headings (the ones with a annot-id and org-pdftools link) to the corresponding PDF file.
  • Added org-noter-pdftools-embed-org-buffer-to-pdf to copy the whole org-noter buffer to a annotation in the left upper corner of the first page in the PDF.
  • Added org-noter-pdftools-jump-to-note config in the README.
  • The prefix of pdftools link can now be customized using org-pdftools-link-prefix, and the default is now set to “pdf”
  • The org-pdftools-search-string-separator is now set to ?? to avoid org fontification problem
  • You can now specify how the path of pdf is stored using two function:
    • org-pdftools-path-generator takes buffer-file-name as an argument, and output a translated path. Default to abbreviate-file-name
    • org-pdftools-path-resolver takes a translated path as an argument and translate it back to absolute path. Default to expand-file-name

Current features

The provided function includes:

  • [X] (Sort-of) backward compatibility with org-pdfview: simply change the link prefix from pdfview: to pdftools:.
  • [X] The reason this URL prefix change was proposed is that pdftools: links can also point to pdf-occur searchs. Multi-file search is also supported.
  • [X] There is also support for pdf-isearch.
  • [X] Beyond the original link implementation that stores only file path and page number, now you can store the precise location of annotations.
  • [X] If there are selected texts on the current PDF page, it will be marked-up using pdf-tools markup functions (by default, underline) automatically and the corresponding annotation id is stored in the link.

Integration with org-noter

You can use the vanilla org-noter now.

  • [X] Integrate with org-noter, such that org-noter can remember the precise location (in the resolution of the exact annotation).
  • [X] Jump from a PDF annotation to a associated org-heading org-noter-sync-* and org-noter-jump-to-heading.
  • [X] Transform old org-noter notes to newer ones and sync with the corresponding PDF. org-noter-convert-old-notes
  • [-] PDF annotation will have full and synced information with the associated org-note. (Besides the note content, each annotate will record the IDs of the corresponding org heading and potentially even it’s parent org heading, such that tree-rebuild is possible.)

Planed features

This is the first step of a set of overhauls of Emacs PDF notetaking experience. The features below are planned (either in this package or as PR to other packages):

  • [-] Optionally grab image/text excerpt from the PDF and insert below the corresponding org-heading. Please refer to pdf-view-extract-region-image, not sure what’s the best way to integrate it.
  • [ ] Link export with image/text-based excerpt from the PDF.
  • [ ] (Long-term) Org <-> PDF Annotation converter.

About

A custom org link type for pdf-tools

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%