SimpleChatTC:PdfText: Numbering T1 - Diff Scheme needed

This simple scheme doesnt work. Rather the pdf outline seems
to follow below logic

If a child list is found when processing the current list, dont
increment the numbering.
This commit is contained in:
hanishkvc 2025-11-08 03:47:25 +05:30
parent 51707b5169
commit bd60437cc6
1 changed files with 3 additions and 3 deletions

View File

@ -15,10 +15,10 @@ def extract_pdfoutline(ol: Any, prefix: str):
Extract the pdf outline Extract the pdf outline
""" """
if type(ol).__name__ != type([]).__name__: if type(ol).__name__ != type([]).__name__:
return f"{prefix}{ol['/Title']}\n" return f"{prefix}:{ol['/Title']}\n"
olText = "" olText = ""
for iol in ol: for (i,iol) in enumerate(ol):
olText += extract_pdfoutline(iol, prefix+"\t") olText += extract_pdfoutline(iol, f"{prefix}.{i+1}")
return olText return olText