| Recommend this page to a friend! |
| All requests |
> | What is the best PHP search text in p... | > | Request new recommendation | > | > |
by Pietro - 1 year ago (2024-08-16)
+2 | Good afternoon, I need to search a text inside a PDF document. Have you got a class for me? Thank you Bye |
1.
by ASCOOS CMS - 1 year ago (2024-10-14) Reply
You can use the ready-made PDFParser library that you will find here: github.com/smalot/pdfparser
An example using it I give you bellow:
require_once 'vendor/autoload.php';
use Smalot\PdfParser\Parser;
$parser = new Parser(); $pdf = $parser->parseFile('example.pdf'); $text = $pdf->getText();
$searchText = "Hello World !!";
if (strpos($text, $searchText) !== false) {
echo "Text found: " . $searchText . "<br>";
} else {
echo "Text not found.";
+1 |
You can use this package to extract text from PDF files. Then you can use PHP text search functions like strpos() to find the text you want in the text extracted from the PDF document. |
| Recommend package | |
|
|