使用 PHP 搜索 PDF 文件

2021-12-20 00:00:00 pdf search php

我正在尝试寻找一种在 PDF 文件中进行搜索的方法.我遇到了 PHP PDF 类,但似乎找不到任何用于读取/搜索文件流的函数.

所以,尽管我很天真,但我尝试使用 file_get_contents() 来简单地获取一个流,显然它是一个类似加密的输出;)

所以我的问题是,有没有办法搜索 PDF 文件?我正在寻找纯脚本/免费/开源解决方案,而不是购买一些昂贵的商业图书馆.

解决方案

XPDF?

有一篇博文 这里 可能会有所帮助.>

似乎有一些代码 here 可以提供帮助 - 一个简单的类,读取将 PDF 转换为纯文本.不确定它是否支持解密.

PHP 文档中还有许多资源可以帮助您.点击.

FPDF 和 FPDI 也可能有帮助.经过一番研究,这可能是您最好的选择.**

I'm trying to find a way to search inside PDF files. I came accross the PHP PDF class but I can't seem to find any function for reading/searching a filestream.

So, as naive as I am, i tried to simple get a stream using file_get_contents(), obviously it's an encrypted-like output ;)

So my question, is there any way to search through PDF files? I'm looking for script-only / free / open source solutions and not buying some expensive commercial libraray.

解决方案

XPDF?

There is a blog post here that may be of help.

There seems to be some code here that could help - a simple class that reads a PDF into plaintext. Unsure if it supports decryption.

There are also a number of resources in PHP documentation that may help you. Click.

FPDF and FPDI may also help. Probably your best bet after some research.**

相关文章