emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: AW <alexander.willand@t-online.de>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <Y9E9zbIEZYUOG30q@protected.localdomain> (raw)
In-Reply-To: <13190256.uLZWGnKmhe@linux.fritz.box>

* 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/


  parent reply	other threads:[~2023-01-25 14:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 20:07 Org mode links: Open a PDF file at a given page and highlight a given string Rodrigo Morales
2021-03-02 22:36 ` Kyle Meyer
2021-03-03 12:37   ` Maxim Nikulin
2021-09-27 16:39   ` Max Nikulin
2021-03-03  2:31 ` Juan Manuel Macías
2021-03-03 14:51   ` Maxim Nikulin
2021-03-03 16:11     ` Juan Manuel Macías
2021-03-05 13:02       ` Maxim Nikulin
2022-09-03 13:00 ` Max Nikulin
2022-09-20 11:54   ` Ihor Radchenko
2022-09-20 17:03     ` Max Nikulin
2022-09-21  8:17       ` Ihor Radchenko
2022-09-21  8:18       ` Ihor Radchenko
2023-01-25 11:46         ` AW
2023-01-25 11:55           ` Ihor Radchenko
2023-01-25 12:35           ` Max Nikulin
2023-01-25 14:33           ` Jean Louis [this message]
2022-10-04  6:45 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y9E9zbIEZYUOG30q@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=alexander.willand@t-online.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).