1. Go to this page and download the library: Download jcfrane/pdf-text-extractor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jcfrane / pdf-text-extractor example snippets
use JCFrane\PdfTextExtractor\PdfTextExtractor;
class ParseResumeAction
{
public function __invoke(PdfTextExtractor $extractor, string $path): string
{
$result = $extractor->extract($path);
if (! $result->isSuccessful()) {
return '';
}
return $result->getText();
}
}
use JCFrane\PdfTextExtractor\Facades\PdfTextExtractor;
$result = PdfTextExtractor::extract(storage_path('app/resumes/candidate.pdf'));
if ($result->isSuccessful()) {
$text = $result->getText();
$strategyUsed = $result->getStrategy(); // pdf_parser, xobject, textract, tesseract
}