Giter Club home page Giter Club logo

pdf-tools-org's Introduction

Introduction

pdf-tools-org is an emacs package that provides integration between pdf-tools and org-mode. The main features are importing and exporting pdf annotations from/to org files.

Installation

  • clone this repo to $PACKAGEDIR:
cd $PACKAGEDIR
git clone https://github.com/pinguim06/pdf-tools-org
  • add initialization your .emacs
(add-to-list 'load-path "$PACKAGEDIR/pdf-tools-org")
(require 'pdf-tools-org)
  • if you want to auto export the annotations after saving a pdf, also add this:
(add-hook 'after-save-hook
          (lambda ()
            (when (eq major-mode 'pdf-view-mode) (pdf-tools-org-export-to-org))))

Usage

  • Use (pdf-tools-org-export-to-org) to export annotations of current pdf file being viewed in PDFView mode to an org file.
  • Use (pdf-tools-org-import-from-org ORGFILE) to import annotations from ORGFILE.

Known issues

  • Importing is not working quite well yet โ€“ multiple annotations may be merged into one and multiple imports may create duplicates.

pdf-tools-org's People

Contributors

machc avatar pinguim06 avatar stardiviner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdf-tools-org's Issues

MELPA package

It would be very nice if we could install this package via package-install.

It would also wider your audience, people like me may be checking new packages to see if there is anything interesting hehehe.

Currently org-store-link support is not very accuracy

When in some PDF, no matter which page I was, org-store-link always generate the same link to same position.
Like this PDF file: http://dtrace.org/guide/dtrace-print.pdf
It always get the same link like file:Data/Books/Dynamic Tracing Guide.pdf::%PDF-1.5.
I tried org-store-link in PDF outline buffer, does not work. But outline jump works fine. Why it always get the same link?

And in some PDF file I got non-ascii link like thsi:

"file:~/Org/Wiki/Computer Technology/Programming/Programming Languages/Clojure/Data/Books/Clojure for the Brave and True.pdf::%PDF-1.6 %\342\343\317\323"

add org-mode link support

Check out this blog entry: http://matt.hackinghistory.ca/2015/11/11/note-taking-with-pdf-tools/

It has some code for add org-mode link support.

I found this version code does not have link to back to PDF annotation page and position.
Really hope pdf-tools-org-export-to-org can support this link.

And here is a short piece of upper blog entry code:

;;; Org-mode link support [[pdfquote:file.org]]
;;; alternative: temporary buffer with custom link type
(defun org-pdfquote-open (link)
  "Open a new buffer with all markup annotations in an org headline with `LINK'."
  (interactive)
  (pop-to-buffer
   (format "*Quotes from %s*"
           (file-name-base link)))
  (org-mode)
  (erase-buffer)
  (insert (pdf-annot-markups-as-org-text link nil 1))
  (goto-char 0)
  )

(defun org-pdfquote-export (link description format)
  "Export the pdfview `LINK' with `DESCRIPTION' for `FORMAT' from Org files."
  (let* ((path (when (string-match "\\(.+\\)::.+" link)
                 (match-string 1 link)))
         (desc (or description link)))
    (when (stringp path)
      (setq path (org-link-escape (expand-file-name path)))
      (cond
       ((eq format 'html) (format "<a href=\"%s\">%s</a>" path desc))
       ((eq format 'latex) (format "\href{%s}{%s}" path desc))
       ((eq format 'ascii) (format "%s (%s)" desc path))
       (t path)))))

(defun org-pdfquote-complete-link ()
  "Use the existing file name completion for file.

Links to get the file name, then ask the user for the page number
and append it."
  (replace-regexp-in-string "^file:" "pdfquote:" (org-file-complete-link)))

(org-add-link-type "pdfquote" 'org-pdfquote-open 'org-pdfquote-export)

Error on annotation export: Invalid tag specification

My setup is:
emacs version: GNU Emacs 27.0.50
Org mode version 9.1.14
pdf-tools-org newest git checkout
pdf-tools from melpa: 20180428.1527

When I tried to export annotations from a pdf I get this error:
Invalid tag specification: 1

This is caused by the org-set-tags 1 function in the pdf-tools-org-export-to-org function in pdf-tools-org.el. If I omit this line, it works and the resulting org file actually has tags. But what might be the problem?

Any help on this?

Thanks

Importation

Nice. Thanks for this.

Importation works (just tested with a highlight with comments) but when I import I have the following things in the comments

+BEGIN_QUOTE

the text I highlighted

+END_QUOTE

my comments

I suppose, I should just have my comments

Also, the format chosen to export is not really useful for me (difficult to read). I'd prefer something like

  • [[linktopdf:page][highlights]]
    comments
    :PROPERTIES:

But I suppose, it is not so easy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.