Giter Site home page Giter Site logo

Comments (5)

politza avatar politza commented on August 22, 2024

Are you thinking of something like hi-lock for PDF buffer ?

Reading, displaying and writing annotations would be possible, i.e. is
supported by the underlying library, and is something I have already
considered.

-ap

from pdf-tools.

trenkert avatar trenkert commented on August 22, 2024

Yes, exactly. I thought that poppler should support this. It would be great to be able to stay in emacs when reading and annotating pdf files.

Ideally, I was thinking about something like highlighting/underlining/marking words in the pdf file and have those highlighted areas linked to another buffer, e.g. to a point in an org-mode buffer where I can comment my highlight and add/attach more information to it.

One could define the behaviour like this: if user starts to highlight stuff in the pdf, automatically create an orgmode-file that has the same name as the pdf (e.g. "test.pdf.org") or let the user define a default org file for annotating pdfs ("~/my_pdf_notes.org"). For every highlight, use org-capture to create a new entry in the orgmode-file with the line number and the first hightlghted words. Let org-capture add date+time information and prompt for user input.

All this can be done without leaving the pdf buffer (org-capture is a pop-up) and at the end, we would have an org file full of annotations on the pdf file in plain text but also easily exportable to LaTeX, presentation slides, blog format etc. Some of the annotations would be marked tasks that appear in an agenda ("find that reference") and others could be tagged and be linked to other tags.

One could then link this information to other bibliographic data for referencing etc.. See here: http://www-public.it-sudparis.eu/~berger_o/weblog/2012/03/23/how-to-manage-and-export-bibliographic-notesrefs-in-org-mode/

from pdf-tools.

politza avatar politza commented on August 22, 2024

The way I see this fitting in the current picture is by extending the types of links of a PDF document. Let's say, there is a new type `user-annotation' or something. Now, normal links (like from an internal \ref) are provided by poppler, but it speaks nothing against adding to these, before handling the display, mouse behaviour etc.

This type would have a designated handler function as an argument, which would be called, when the corresponding link is activated by the user.

Creating and deleting them interactively, e.g. by dragging the mouse, isn't very hard either.

-ap

from pdf-tools.

trenkert avatar trenkert commented on August 22, 2024

Great! Sounds perfect! Unfortunately, I am not a programmer but I will certainly test if it is going to work. And I can imagine that the org-mode community would love this, too. If you are going to include this into your project, maybe you would like to make a small announcement here: http://news.gmane.org/gmane.emacs.orgmode

from pdf-tools.

politza avatar politza commented on August 22, 2024

I think this is all possible now,
i.e. pdf-annot-activate-handler-functions allows for arbritrary
stuff to happen, when some annotation was clicked upon and custom
annotations may be identified by creating them with some unique label
property. Here is a toy example:

(require 'pdf-annot)

(add-hook 'pdf-annot-activate-handler-functions 'pdf-org-annotation-handler)
(add-hook 'pdf-annot-print-annotation-functions 'pdf-org-print-annotation)
(setq pdf-annot-activate-created-annotations t)

(defun pdf-org-add-annotation (pos)
  (interactive
   (list (pdf-util-read-image-position "Click ...")))
  (pdf-annot-add-text-annotation
   pos
   "Circle"
   `((color . "yellow")
     (label . "org:annot"))))


(defun pdf-org-annotation-handler (a)
  (when (equal (pdf-annot-get a 'label)
               "org:annot")
    (pop-to-buffer (get-buffer-create "annotations.org"))
    ;; Do SOMETHING.
    t))

(defun pdf-org-print-annotation (a)
  (when (equal (pdf-annot-get a 'label)
               "org:annot")
    "Org annotation, click to do SOMETHING"))

I guess I'll be closing this then.

from pdf-tools.

Related Issues (20)

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.