$file = $directory.'/'.$filename; $fileinfo = pathinfo($filename); $content = ""; // pdt to text if($fileinfo['extension'] == 'pdf') { $outpath = preg_replace("/\.pdf$/", "", $file).".txt"; system("pdftotext -enc UTF-8 ".escapeshellcmd($file), $ret); if($ret == 0) { $content = file_get_contents($outpath); unlink($outpath); } }
I'm not a developer, i always use this free online pdf to text converter to convert pdf to text online.
ReplyDelete