Majid AlSaidi's avatar

PDF To Text

What I want: extract text to pdf. What I'm using: spatie/pdf-to-text , git link: https://github.com/spatie/pdf-to-text

which pdftotext result:

/usr/bin/pdftotext

My Code:

use Spatie\PdfToText\Pdf;
Pdf::getText($m_url, '/usr/bin/pdftotext')

The Error:

Spatie\PdfToText\Exceptions\PdfNotFound
Could not read `url_to_pdf.pdf`

Note: I can access the file when I enter the url(pdf url).

Can Anyone help me with this issue? I traied deferent pdf files.

edit1: screenshot: https://i.imgur.com/y2DuFYA.png

0 likes
1 reply
Majid AlSaidi's avatar
Majid AlSaidi
OP
Best Answer
Level 1

Issue has been Solved:

You should put the full path of the file, not the url!

So, I was taking the url like this: $m_url = $record->media[0]->original_url;

I change it to this to get the full path url: $m_url = $record->media[0]->getPath();

Please or to participate in this conversation.