内置字体在 pdf2docx python 中不可用

问题描述 投票:0回答:1

这是将书籍从 pdf 格式转换为 word 格式的代码。

from pdf2docx import Converter

cv = Converter('Calculus.pdf')
cv.convert('Calculus.docx', start=0, end=None) 
cv.close()

我的 pdf 似乎有 Arial 字体的文本,但它无法检测到它......所以我收到此错误

    _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' 

但是这个字体在我的电脑上可用,在路径中

C:\WINDOWS\FONTS\ARIAL.TTF

有什么方法可以将此字体包含在我的程序中以便 pdf2docx 能够检测到它吗?

python pdf fonts docx
1个回答
0
投票

我也面临着同样的问题。有人可以帮忙吗?

© www.soinside.com 2019 - 2024. All rights reserved.