문제

I want to make PDFs from external URLs searchable. I'm using pdftotext from XPDF. It's working fine with PDFs already on my webspace, but I keep getting an error message when trying to use external PDFs instead. Specifically I get:

"Error: Couldn't open file 'https://www.vericoa.com/sandbox/test2.pdf' "

Here is my code

$path = 'https://www.vericoa.com/sandbox/test2.pdf'; 

echo shell_exec('pdftotext -enc UTF-8 '.$path.' pdf.txt 2>&1');  

$file = file_get_contents('pdf.txt');

echo $file;

Is it even possible to extract text from external PDF sources? Are there any alternatives (I spent the last hours searching, but found nothing).

Thanks in advance Matthias

도움이 되었습니까?

해결책

You could perhaps try downloading the external URL in php, saving it to a file and passing that to the pdftotext script?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top