'''
PDFFILE=""
PDF_NAME=""
def pdf_btnClicked():
global PDFFILE, PDF_NAME
PathOfPDF = askopenfile()
PDFFILE = PathOfPDF.name
print(PDFFILE)
if PDFFILE == "":
return
else:
PDFLocation["text"] = PDFFILE
# return PDFFILE
# PDFFILE1=PDFFILE.get
PDF_NAME= str(basename(normpath(PDFFILE)))
print(PDF_NAME)
pages = 1
page_no = 1
pdfReader=''
def selectBtnClicked():
global book
global PDFFILE
global pages
global page_no
global pdfReader
print(PDFFILE)
book = open(PDFFILE, 'rb')
pdfReader = PyPDF2.PdfFileReader(book)
pages = pdfReader.numPages
print(pages)
pages += 1
page_no = [i for i in range(1, pages)]
print(page_no)
startfromLabel["values"] = page_no
PDF_NAME_LABEL["text"]=PDF_NAME
PDF_NAME_LABEL.place_forget()
PDF_NAME_LABEL.pack(side=TOP, pady=20)
startfromLabel.pack(side=TOP, pady=25)
return page_no, pdfReader
def startBtnClicked():
global pdfReader
choice=startfromLabel.get()
print(choice)
speaker = pyttsx3.init('sapi5')
voices = speaker.getProperty('voices')
speaker.setProperty('voice',voices[1].id)
page = pdfReader.getPage(int(choice))
text = page.extractText()
speaker.say("Thank YOU SIR, SELECTING ME FOR THIS JOB!!!")
print("Thank YOU SIR SELECTING ME FOR THIS JOB!!!")
speaker.say(text)
print("Started")
root.update()
speaker.runAndWait()
'''
我在python中做了一个pdf describer
使用。PyPdf2
但我面临一个问题,即它可以在某些 pdf 中正常工作,但在其他一些 pdf 文件中它不起作用
问题示例:-
它在 oop.pdf 上正常工作,但在the_portrait_of_mr._w 上不起作用。.pdf _
请帮我解决这个问题
感谢您