Hi Rodrigo,

Rodrigo Morales <moralesrodrigo1...@gmail.com> writes:

> I want to be able to
>
> + create a Org link to specific pages of a PDF. I've managed to
>   accomplish this by setting the following value.
> [ ... ]
> + create a Org link to specific pages of a PDF and highlight a given
>   string.

A possible alternative, which gives you more control over the link, is
`org-link-set-parameters'. For example:

#+begin_src emacs-lisp
  (org-link-set-parameters
   "pdf-pag"
   :follow (lambda (path)
             (let ((pag (if (string-match "::\\([1-9]+\\):*:*\\(.*\\)" path)
                            (match-string 1 path)
                          (error "no pages")))
                   (clean-path (expand-file-name (replace-regexp-in-string 
"::.+" "" path)))
                   (str (when (string-match "::\\([1-9]+\\)::\\(.+\\)" path)
                          (match-string 2 path))))
               (start-process-shell-command "zathura" nil (concat "zathura "
                                                                  clean-path
                                                                  " -P "
                                                                  pag
                                                                  (when str
                                                                    (format " 
-f '%s' " str)))))))
#+end_src

And then:

#+begin_src org
  [[pdf-pag:~/Downloads/grub.pdf::95::do]]
#+end_src

Best regards,

Juan Manuel 

Reply via email to