Recommend this page to a friend! |
All requests | > | Searching a text inside a pdf | > | Request new recommendation | > | Featured requests | > | No recommendations |
by Pietro - 5 months ago (2024-08-16)
+1 | good afternoon, I need to search a text inside a pdf/A document, have you got a class for me? Thank you Bye |
1. by ASCOOS CMS - 3 months 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.";
Recommend package | |
|