jeudi 7 mars 2019

Laravel - PDF: Cannot encode text from PDF to Text

I am trying to upload the PDF file and want to convert it from PDF to Text. Some of the files are able to convert and get the text from the PDF with charm but some of them having issues as shown in the screenshots. There are two different examples, (although it shows 3 but 2 are the same) The top one and the second one are the same which I think its not a properly encoded (not sure) and the third one, it only captures the half info from the PDF. The main content that I need is after it stops.

How can I fix this?

enter image description here

use App\FilePdf;
use Spatie\PdfToText\Pdf;


$name=$file->getClientOriginalName();
$file->move(public_path().'/pdftotext/', $name);
$path = public_path('/pdftotext/'. $name);
$reader = new \Asika\Pdf2text;
$output = $reader->decode($path);
$data[] = $name;
$output = str_replace(array("\n", "\r"), '', trim($output));

dd($output);

Or if there is any alternate solution for this problem, please suggest.

Thanks and appreciate for your time.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire