从PDF中,提取具有命令行的页码的亮点

发布于 2025-02-12 17:51:16 字数 460 浏览 1 评论 0原文

有没有一种方法可以从PDF中提取具有从命令行的相应页码的突出显示段落?我找到了两个工具,但它们并不完全满足我的需求: pdf-highlights-extractor 允许我要使用页码提取突出显示的段落,但没有命令行接口,只有图形接口。 dyAnnotationExtractor 具有命令行接口,但只给了我突出显示的段落,而不是页码。有没有可以做我需要的工具?顺便说一句,我在Linux上。

预先感谢您的帮助!

Is there a way to extract, from a PDF, the highlighted passages with the corresponding page numbers from the command line? I found two tools, but they do not exactly fit my needs: pdf-highlights-extractor allows me to extract the highlighted passages with the page numbers, but it does not have a command line interface, only a graphical interface. And DyAnnotationExtractor has a command line interface, but only gives me the highlighted passages, not the page numbers. Is there a tool that can do what I need? I am on Linux, by the way.

Thank you in advance for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你在看孤独的风景 2025-02-19 17:51:16

我建议使用漂亮的小python库 pdfannots ,这具有您想要的功能。

$ pdfannots document.pdf

如果与其他一些bash命令结合使用,它可以产生格式良好的输出。例如:

$ pdfannots document.pdf --no-condense | \
# Removing duplicate lines:
cat -n | sort -uk2 | sort -nk1 | cut -f2- | \
# Improving output formatting:
awk '{$1=$1};1' | sed 's/^\(> \)//g' | sed 's/* Page #/\n&/'

I would recommend usage of the nifty little Python library pdfannots, which has the very capability you are looking for.

$ pdfannots document.pdf

If combined with some other Bash commands, it can produce nicely formatted output. For example:

$ pdfannots document.pdf --no-condense | \
# Removing duplicate lines:
cat -n | sort -uk2 | sort -nk1 | cut -f2- | \
# Improving output formatting:
awk '{$1=$1};1' | sed 's/^\(> \)//g' | sed 's/* Page #/\n&/'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文