Reputation: 73
I have a task of reading pdf files after an upload in the DB or n a folder,
What is the question here is : How to read PDF files in PHP or JS, JQuery, AJAX, Then i want to recuperate the datas to inject in a form fields.
There's a lot of infos to do this process with text files but pdf seems complicated. There is a PHP class for that ? I'm not used to classes in Php but with infos, it would lead me.
Thanks a lot for help!! Have a grreat one!
Upvotes: 2
Views: 1572
Reputation: 76
I managed to do this using http://www.pdfparser.org/
I needed the specifications from a pdf file and get all the raw text. This is the code I used:
<?php
include 'pdfparser-master/vendor/autoload.php';
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('specs.pdf');
$text = $pdf->getText();
echo $text;
?>
Upvotes: 2