Skip to content

Commit

Permalink
fix error appearing in dev environment:
Browse files Browse the repository at this point in the history
when the table of contense is created now an error appears.
This commit attepst to avoid this error.
  • Loading branch information
marionb committed Sep 6, 2023
1 parent ecb0905 commit 389f924
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def __call__(self, value, system):
pdf_reader = PdfReader(pdf)
x = []
for i in range(len(pdf_reader.outline)):
x.append(pdf_reader.outline[i]['/Page']['/StructParents'])
if isinstance(pdf_reader.outline[i], list):
x.append(pdf_reader.outline[i][0]['/Page']['/StructParents'])
else:
x.append(pdf_reader.outline[i]['/Page']['/StructParents'])
try:
true_nb_of_toc = min(x)-1
except ValueError:
Expand Down

0 comments on commit 389f924

Please sign in to comment.