简体   繁体   English

如何使用 DBus 从 Evince 中打开的 PDF 文档获取当前页码?

[英]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?如果我在 evince(GNOME 文档查看器)中打开一个 PDF 文档,我如何使用 DBus 获取当前页码?

using zathura I could get the page number using the following command:使用 zathura 我可以使用以下命令获取页码:

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). (我使用D-Feet获取总线、object 和接口名称)。

However, when it comes to Gnome evince, I can't find any API to retrieve the current page number.但是,当涉及到 Gnome evince 时,我找不到任何 API 来检索当前页码。

Are there any options to achieve that?有什么选择可以实现这一目标吗?

PS: I am using evince 3.36.10 on Ubuntu 20.04 PS:我在 Ubuntu 20.04 上使用 evince 3.36.10

I think there is no way to retrieve that information using DBus.我认为没有办法使用 DBus 检索该信息。 However, one can use GVFS (Gnome Virtual File System) to retrieve the metadata relevant to the page number:但是,可以使用 GVFS(Gnome 虚拟文件系统)检索与页码相关的元数据:

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.一个重要的注意事项(根据我的测试)是该文档不应位于/tmp目录下,因为这些元数据似乎未保存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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