【发布时间】:2021-01-25 04:51:38
【问题描述】:
我有一个脚本,列出了 PDF 文件 Parse annotations from a pdf 的注释:
import popplerqt5
import argparse
def extract(fn):
doc = popplerqt5.Poppler.Document.load(fn)
annotations = []
for i in range(doc.numPages()):
page = doc.page(i)
for annot in page.annotations():
contents = annot.contents()
if contents:
annotations.append(contents)
print(f'page={i + 1} {contents}')
print(f'{len(annotations)} annotation(s) found')
return annotations
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('fn')
args = parser.parse_args()
extract(args.fn)
但它只适用于文本注释,有很多 Python 库,如 Poppler、PyPDF2、PyMuPDF,我已经一直在搜索他们的文档和源代码,就我而言,他们are not able to 提取了声音注释的二进制文件。你知道任何可以做到这一点的图书馆吗?我需要提取这些声音注释的二进制文件并将它们转换为 MP3。
【问题讨论】:
标签: python python-3.x python-2.7 pypdf2 poppler