有一个工具叫pdftohtml,它在poppler-utils软件包中,安装命令:
sudo apt-get install poppler-utils在PHP中,您可以使用shell_exec或exec函数来执行命令行操作。以下是使用shell_exec的示例:
$pdfFilePath = 'path_to_your_pdf.pdf'; $outputHtmlFilePath = 'output.html'; $command = "pdftohtml -s \"$pdfFilePath\" \"$outputHtmlFilePath\""; $result = shell_exec($command); if ($result !== null) { echo "PDF转换为HTML成功!"; } else { echo "PDF转换为HTML时出现问题."; }
网友回复