将pdf转换为docx,而无需更改python3.x中的字体大小,粗体等

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

我想在ubuntu16.x中使用python3.x将PDF转换为docx。我通过下面给出的代码:

for top, dirs, files in os.walk(pdfdir):
  for filename in files:
    if filename.endswith('.pdf'):
        i = i + 1
        abspath_pdf = os.path.normpath(os.path.join(top, filename))

        print 'Converting {0} into .doc format..'.format(abspath_pdf)
        subprocess.call('{0} --invisible --convert-to doc{1} --outdir "{2}" "{3}"'
                        .format(lowriter, outfilter, docdir, abspath_pdf), shell=True)

但是它对我不起作用。有人可以帮忙吗?

提前感谢。

pdf python-3.6 doc
1个回答
0
投票
您可以使用Aspose.Words Cloud将PDF转换为MS Word格式https://products.aspose.cloud/words/python您还应该注意,PDF格式是固定页面格式,MS Word格式是流格式。这使得从PDF到MS Word的转换非常困难。 Aspose.Words Cloud可以识别PDF中的元素,因此输出可以在MS Word中编辑。请参阅以下链接,以了解有关将PDF转换为Word的更多信息https://docs.aspose.cloud/display/wordscloud/Convert+PDF+Document+to+Word
© www.soinside.com 2019 - 2024. All rights reserved.