Bug 443390 - Feature Request: Command Line option to get the last page of reading when exit.
Summary: Feature Request: Command Line option to get the last page of reading when exit.
Status: RESOLVED INTENTIONAL
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-06 12:12 UTC by shenlebantongying
Modified: 2021-11-24 06:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shenlebantongying 2021-10-06 12:12:44 UTC
I want to automate the reading progress over my large pile of PDFs. 

I need the ability to let my other programs know where I read the last page when close the PDF.

Okular can remember the lasted opened position (i think?), but I want to have a bird-overview of my reading progress on all my PDFs.

If I can the last page of reading from `stdout` when I exit Okular, I can automatically put that value into my databases.

What if, let's say `Okular --log nice.pdf`, then I can open okular via a script then send the value to database. Scripting a GUI application! 

I might be the only want this :/

Probably this should be made as a standalone application.

Does Okualr can be used as a KPart?
Comment 1 shenlebantongying 2021-10-06 12:15:39 UTC
No, this shouldn't be a standalone application.

If you already have an existing solution for bibliography management, like Zotero, you don't want to duplicate the functionality.
Comment 2 Laura David Hurka 2021-10-06 19:01:16 UTC
(In reply to shenlebantongying from comment #0)
> Okular can remember the lasted opened position (i think?),

Yes, not only the last position. Okular stores the viewport history in XML files, usually under ~/.local/share/okular/docdata/. It should be possible to parse these, although not very convenient.

> Scripting a GUI application! 
> 
> I might be the only want this :/

No, this is one use case for D-Bus. You can try the application d-feet to look which D-Bus methods are available in Okular. For example, you can query the currentPage() method. Of course, you need to query it before Okular is closed.

> Does Okualr can be used as a KPart?

Yes, the okularpart component, which is used by the “Okular” desktop application, is actually a KPart in a shared library. It provides the same currentPage() method.
Comment 3 Albert Astals Cid 2021-10-06 21:39:47 UTC
Sorry, but you're asking for something super strange, I see no reason at all why we would add such an option to Okular.