Skip to content
Snippets Groups Projects
Commit 6acea371 authored by tuhe's avatar tuhe
Browse files

fixed pdf file reader

parent 7ac8806a
Branches
No related tags found
No related merge requests found
Pipeline #14233 failed
......@@ -132,8 +132,8 @@ def set_svg_background_images(lecture_tex, verbose=False,
import PyPDF2 # Import PyPDF2 here. There is a strange issue (possibly bad package version?) which makes it inappropriate as a top-level import (CI/CD Breaks).
with open(lecture_tex_nosvg_pdf, 'rb') as f:
pdfdoc = PyPDF2.PdfReader(f)
for i in range(pdfdoc.getNumPages()):
content = pdfdoc.getPage(i).extractText()
for i in range(len(pdfdoc.pages)):
content = pdfdoc.pages[i].extractText()
for osvg_name, d in sinfo.items(): #enumerate(sinfo):
if d['pdf_label'] in content:
......@@ -203,8 +203,8 @@ def slide_no_by_text(pdf_file, text):
with open(pdf_file, 'rb') as f:
print(pdf_file)
pdfdoc = PyPDF2.PdfReader(f)
for i in range(pdfdoc.getNumPages()):
content = pdfdoc.getPage(i).extractText()
for i in range(len(pdfdoc.pages)):
content = pdfdoc.pages[i].extractText()
# for j, d in enumerate(sinfo):
if text in content:
return i+1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment