21,886
社区成员
发帖
与我相关
我的任务
分享
// 获取参数,文件所在路径
$path = $_GET['path'];
// 创建源码中的Parser类对象
$parser = new \Smalot\PdfParser\Parser();
// 调用解析方法,参数为pdf文件路径,返回结果为Document类对象
$document = $parser->parseFile($path);
// 获取所有的页
$pages = $document->getPages();
// 逐页提取文本
foreach($pages as $page){
echo($page->getText());
}