RuntimeError: cannot find builtin font with name 'Arial'
使用Python中pdf2docx进行pdf转Word,部分文档转化失败,报错信息如下:
[INFO] [1/4] Opening document...
[INFO] [2/4] Analyzing document...
Exception in Tkinter callback
Traceback (most recent call last):
File "D:\devtool\python\lib\tkinter\__init__.py", line 1921, in __call__
return self.func(*args)
File "D:\storage\python_storage\python_learn\demo_pdfToWord.py", line 86, in <lambda>
command=lambda: create_popup(windowWidth, windowHeight, screenWidth, screenHeight))
File "D:\storage\python_storage\python_learn\demo_pdfToWord.py", line 48, in create_popup
pdfToWord(file_path)
File "D:\storage\python_storage\python_learn\demo_pdfToWord.py", line 13, in pdfToWord
cv.convert(word_file)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\converter.py", line 329, in convert
self.parse(start, end, pages, **settings).make_docx(docx_filename, **settings)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\converter.py", line 112, in parse
return self.load_pages(start, end, pages) \
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\converter.py", line 153, in parse_document
self._pages.parse(self.fitz_doc, **kwargs)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\page\Pages.py", line 37, in parse
raw_page.restore(**settings)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\common\share.py", line 226, in inner
objects = func(*args, **kwargs)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\page\RawPage.py", line 67, in restore
super().restore(raw_dict)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\layout\Layout.py", line 74, in restore
self.blocks.restore(data.get('blocks', []))
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\layout\Blocks.py", line 98, in restore
block = TextBlock(raw_block)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\text\TextBlock.py", line 49, in __init__
self.lines = Lines(parent=self).restore(raw.get('lines', []))
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\text\Lines.py", line 31, in restore
line = Line(raw)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\text\Line.py", line 54, in __init__
self.spans = Spans(parent=self).restore(raw.get('spans', []))
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\text\Spans.py", line 19, in restore
span = TextSpan(raw_span)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\text\TextSpan.py", line 78, in __init__
self._change_font_and_update_bbox(constants.DEFAULT_FONT_NAME)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\pdf2docx\text\TextSpan.py", line 121, in _change_font_and_update_bbox
font = fitz.Font(font_name)
File "D:\storage\python_storage\python_learn\venv\lib\site-packages\fitz\fitz.py", line 9383, in __init__
_fitz.Font_swiginit(self, _fitz.new_Font(fontname, fontfile, fontbuffer, script, language, ordering, is_bold, is_italic, is_serif, embed))
RuntimeError: cannot find builtin font with name 'Arial'
想请教各位大佬,RuntimeError: cannot find builtin font with name 'Arial'这种如何处理.
应该是fitz.py没有内置宋体导致转换失败,求解答!