[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Org mode links: Open a PDF file at a given page and highlight a give
From: |
Jean Louis |
Subject: |
Re: Org mode links: Open a PDF file at a given page and highlight a given string |
Date: |
Wed, 25 Jan 2023 17:33:49 +0300 |
User-agent: |
Mutt/2.2.9+54 (af2080d) (2022-11-21) |
* AW <alexander.willand@t-online.de> [2023-01-25 14:48]:
> Has this been done? I'm struggeling (again), how to link to a certain page of
> a PDF, being opened in okular.
>
> ./link/xyz.pdf::123 does not open the pdf at p. 123
Simply do elisp: links with the below function:
[[elisp:(rcd-okular "/home/user/my-file" 2 "small percentage")][small
percentage]]
(defun rcd-okular (file &optional page query-string)
"Open `okular' on PDF FILE.
PAGE is optional page number
QUERY-STRING will be eventually found highlighted."
(let* ((okular (executable-find "okular"))
(args (list file))
(args (if page (append (list "-p" (format "%s" page)) args) args))
(args (if query-string (append (list "--find" query-string) args)
args))
(name "*Okular*")
(buffer (generate-new-buffer-name name)))
(cond (okular
(apply #'start-process name buffer okular args))
(t (user-error "Program `okular' not found")))))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/