Mar-25-2021, 03:00 PM
For others' benefit: If the PDF contains a ToC ("bookmarks"), it might have what you're looking for.
#pip install PyMuPDF import fitz doc = fitz.open("input.pdf") toc = doc.getToC() for item in toc: print(item[1])