OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to read pdf form fields smalot/pdfparser?

  • Thread starter Thread starter Liju
  • Start date Start date
L

Liju

Guest
I am trying to read data from pdf and save into separate columns(Name,Address,Email,Company) but the smalot/pdfparser returning output as string

Code:
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('document.pdf');
$output= $pdf->getText();
echo $output;

output = Name:test Address:test 123 email:[email protected] company:abc

How can I convert this to an array like this

Code:
[
 'Name'=> 'test',
 'Address'=> 'test 123',
 'Email`=>`[email protected]',
 'Company'=>'ABC'
]
<p>I am trying to read data from pdf and save into separate columns(Name,Address,Email,Company) but the smalot/pdfparser returning output as string</p>
<pre><code>$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('document.pdf');
$output= $pdf->getText();
echo $output;
</code></pre>
<p>output = Name:test Address:test 123 email:[email protected] company:abc</p>
<p>How can I convert this to an array like this</p>
<pre><code>[
'Name'=> 'test',
'Address'=> 'test 123',
'Email`=>`[email protected]',
'Company'=>'ABC'
]
</code></pre>
Continue reading...
 
Top