卖柴火的小伙子 2023-11-10 16:15 采纳率: 33.3%
浏览 17

RuntimeError: cannot find builtin font with name 'Arial'

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没有内置宋体导致转换失败,求解答!

  • 写回答

2条回答 默认 最新

  • 梦幻精灵_cq 2023-11-11 12:35
    关注
    • “Arial”,好像是“艺术字体”的英文名吧。
      您这是缺少字体啊

      img


    评论

报告相同问题?

问题事件

  • 创建了问题 11月10日

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大