emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link to open PDF at a specific page


From: Jean Louis
Subject: Re: Link to open PDF at a specific page
Date: Sat, 14 Nov 2020 14:34:53 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Georges Ko <gko@gko.net> [2020-11-14 11:48]:
> If I export the file as HTML, it is output as:
> 
>   <a href="file:///c:/a/b/c/file.pdf#MissingReference">...</a>
> 
> so I modified org-html-link from:
> 
>   (concat raw-path
>         "#"
>         (org-publish-resolve-external-link option path t))
> 
> to
> 
>   (concat raw-path
>         "#"
>         (let ((r (org-publish-resolve-external-link option path t)))
>           (or (and (string= r "MissingReference")
>                    (string-match "\\.pdf\\'" path)
>                    (string-match "[0-9]+" option)
>                    (format "page=%s" option))
>               r)))
> 
> which generates the wanted HTML link:
> 
>   <a href="file:///c:/a/b/c/file.pdf#page=4">...</a>
> 
> Is there any way less quick & dirty to achieve this?

General function in plan Org program files shall not be modified in
the main development branch to serve a specific PDF reader on specific
OS system as that is hard coding and there are many PDF readers which
all behave in different manner.

Instead it is better if you make your custom link for Org that does
what you want.

It looks as being possible to be customized by using
org-link-abbrev-alist

Is it?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]