title: laravel 7 pdf-to-text | Could not read pdf file
body: <p>I installed this laravel package to convert pdf file into text. <a href="https://github.com/spatie/pdf-to-text" rel="nofollow noreferrer">https://github.com/spatie/pdf-to-text</a></p>
  <p>I'm getting this error:</p>
  <blockquote>
  <p>Could not read <code>sample_1610656868.pdf</code></p>
  </blockquote>
  <p>I tried passing the file statically by putting it in public  folder and by giving path of uploaded file.</p>
  <p>Here's my controller:</p>
  <pre><code>public function pdftotext(Request $request)
  {
  
      if($request-&gt;hasFile('file'))
      {
          // Get the file with extension
          $filenameWithExt = $request-&gt;file('file')-&gt;getClientOriginalName();
          //Get the file name
          $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
          //Get the ext
          $extension = $request-&gt;file('file')-&gt;getClientOriginalExtension();
          //File name to store
          $fileNameToStore = $filename.'_'.time().'.'.$extension;
          //Upload File
          $path = $request-&gt;file('file')-&gt;storeAS('public/ebutifier/pdf', $fileNameToStore);
      }
      
      // dd($path);
  
      $location = public_path($path);
  
      // $pdf = $request-&gt;input('file');
  
      // dd($location);
      // echo Pdf::getText($location, 'usr/bin/pdftotext');
  
      $text = (new Pdf('public/ebutifier/pdf/'))
              -&gt;setPdf($fileNameToStore)
              -&gt;text();
  
              return $text;
  }
  </code></pre>
  <p>Not sure why it's not working any help would be appreciated.</p>