【发布时间】:2012-02-14 23:58:08
【问题描述】:
我的文件夹中有许多 PDF。我想使用 xpdf 从这些 PDF 中提取文本。例如:
- example1.pdf 提取到 example1.txt
- example2.pdf 提取到 example2.txt
- 等等..
这是我的代码:
<?php
$path = 'C:/AppServ/www/pdfs/';
$dir = opendir($path);
$f = readdir($dir);
while ($f = readdir($dir)) {
if (eregi("\.pdf",$f)){
$content = shell_exec('C:/AppServ/www/pdfs/pdftotext '.$f.' ');
$read = strtok ($f,".");
$testfile = "$read.txt";
$file = fopen($testfile,"r");
if (filesize($testfile)==0){}
else{
$text = fread($file,filesize($testfile));
fclose($file);
echo "</br>"; echo "</br>";
}
}
}
我得到空白结果。我的代码有什么问题?
【问题讨论】:
-
你有没有尝试过?放置良好的回声语句怎么样