In #KDE, using #Okular, is there any chance there is a hidden hotkey to "Rename selected bookmark"? I have hundreds to rename (band book #pdf) and while I can cursor down and hit return to open the next one, it appears the ONLY way to then Rename is to move the mouse over that line and right click. Would be SO very nice to just hit Ctrl-R or something, type the new name, hit return and repeat.

It is also odd when I use Ctrl-B to bookmark, it doesn't ask for a name?

And after meticulously entering seven hundred titles as #pdf 'bookmarks' it turns out #okular is lying, it doesn't save 'bookmarks' at all! At least that's what #KDE document reader says, and, sadly, #mobilesheets too.

In cyberspace nobody can hear you scream…

Apparently these are not #pdf bookmarks, they are global #KDE desktop bookmarks, and if you move or rename the pdf, they vanish, and this is by design. Every other app would put them in the TOC, #okular likely hides them in the graph database?

I recall a utility to query kde in #sparql, but not its name, and Google is useless, but perhaps with it there's a namespace with today's hours of tedious labour in it?

Or maybe I will just use screenshots and ocr… 😞

oh, at least I can save some typing, a search for something else (how to access the graph) led to a comment about a bookmarks xml file for a different app and it gave the location!

So I have ~/.local/share/okular/bookmarks.xml and it's xml, like how much xsl could it possibly take to get that into the file's TOC via pdftk?

"We do these things not because they are easy…"

With any luck, pdftk will like this (of course Mastodon will ruin the formatting):

import xml.etree.ElementTree as ET

root = ET.parse('bookmarks.xml')
bb='BookmarkBegin'
bt='BookmarkTitle'
bl='BookmarkLevel: 1'
bp='BookMarkPageNumber'

for elem in root.findall('.//bookmark'):
page=elem.attrib.get('href').split('#')[-1]
title=elem.find('title').text
print(f'{bb}\n{bt}: -- {title} --\n{bl}\n{bp}: {page}')

as easy as that was to whip up, #pdftk would not accept any of several variations, and hunting about there appears no evidence it has worked for anyone for at least two years. So I rewrote the script to generate the csv file that #MobileSheets accepts, which it happily did β€” I should have done this the first time, but whatever, now I have the book on a tablet!