i am looking for the way to extract data from text file and store it to array so that in later stages i can use the stored data in array pass to another view.
First , i have used pdfparser to convert pdf to text file and now need to get data from that text file to pass to the another view.
I require expert advice on this, please help
here is the code
function do_parse($file_name) {
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile(APPPATH.'/upload/'.$file_name);
$details = $pdf->getDetails();
// Retrieve all pages from the pdf file.
$pages = $pdf->getPages();
// Loop over each page to extract text.
foreach ($pages as $page) {
echo $page->getText();
foreach ($details as $property => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
echo $property . ' => ' . $value . "
";
} }