Ben
Ben

Reputation: 11188

Search through PDF files with PHP

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.

Upvotes: 15

Views: 51267

Answers (2)

Daniel May
Daniel May

Reputation: 8226

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.**

Upvotes: 13

akamike
akamike

Reputation: 2158

A PHP search engine called Sphider has the option of adding PDF search via XPDF. You can then customise the result templates to fit in with the rest of your site (if applicable).

Upvotes: 2

Related Questions