Hello,
Before I look further, is there an easier way I should know about to modify the page number on each line in a PDF's bookmark file?
I removed the ToC at the beginning, so each page number should have 11 substracted to it to match the new order.
Cheers,
Edit: LibreOffice Calc to the rescue
Before I look further, is there an easier way I should know about to modify the page number on each line in a PDF's bookmark file?
I removed the ToC at the beginning, so each page number should have 11 substracted to it to match the new order.
Cheers,
import re
#0 "My title" 24 → 0 "My title" 13
pattern_number = re.compile("^0 .+ (\d+)$")
with open('bookmarks.txt', encoding="utf-8") as reader:
for line in reader.readlines():
if (m := pattern_number.search(line)):
print(m.group(1))
#rewrite line
#save all to file--Edit: LibreOffice Calc to the rescue
