简体   繁体   中英

How do I get the current page number from an open PDF document in Evince using DBus?

If I open a PDF document inside evince (GNOME Document Viewer), how do I get the current page number using DBus?

using zathura I could get the page number using the following command:

busctl get-property --user org.pwmt.zathura.PID-1123767 \
 /org/pwmt/zathura \ 
org.pwmt.zathura pagenumber

(I have used D-Feet to get the bus, object, and interface names).

However, when it comes to Gnome evince, I can't find any API to retrieve the current page number.

Are there any options to achieve that?

PS: I am using evince 3.36.10 on Ubuntu 20.04

I think there is no way to retrieve that information using DBus. However, one can use GVFS (Gnome Virtual File System) to retrieve the metadata relevant to the page number:

gio info -a "attributes::evince::page" /path/to/the/pdf/file

This informations is updated whenever you scroll the page.

One important note (according to my tests) is that the document should not be under /tmp directory as it appears that those metadata are not saved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM