0

I want to parse PDF file from PHP. For this, I have build this code (I have used PDF Parser library).

Code:

<?php
     
    // Include Composer autoloader if not already done.
    include 'vendor/autoload.php';
     
    // Parse pdf file and build necessary objects.
    $parser = new \Smalot\PdfParser\Parser();
    $pdf    = $parser->parseFile('XA035 - Luis gui Lopes esteves.pdf');
     
    $text = $pdf->getText();
    echo $text;
?>

With this code, I'm able to read the text from PDF file but I'm not able to parse the information because for example, if in the file I have this line:

PERSONAL INFORMATION Marco Mengoni

Italia

Via della giustizia

when I call my page the echo $text; print this on the page:

PERSONAL INFORMATION Marco Mengoni Italia Via Della Giustizia.

Now is there a mode to parse single line????

Community
  • 1
  • 1
bircastri
  • 2,169
  • 13
  • 50
  • 119

0 Answers0