html - 使用 Linux -poppler-utils-pdftohtml 从 pdf 生成带有图像的 html

标签 html linux pdf pdf-to-html

目前我正在使用 pdftohtml,在 CentOS 下,poppler-utils。概念很简单——用户上传 PDF 文件并查看该文件的 HTML 版本。我使用简单的命令 -

$> pdftohtml source.pdf target.html 

但是没用!后来,我尝试使用没有框架的复杂开关创建 html:

$> pdftohtml -c - noframes source.pdf target.html 

仍然没有运气!问题是 - pdf 文件的图像(图像在那个 pdf 文件中)不能出现在 html 中,有时,图像会重叠!有什么想法吗?

这是 PHP 代码 -

Add.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<title>CompleteView</title>
</head>
<body>
 <form method="post" action="save.php" enctype="multipart/form-data">
       <input type="hidden" name="action" value="add">
        <tr class="dark_bgcolor text-content">
         <td align="left" width="20%">Upload</td>
         <td align="left" width="1%">:</td>
         <td align="left">
         <input type="file" name="img_full" class="look" size="50"> 
         (Only .pdf)
         </td>
       </tr>

       <tr class="bottom_bgcolor">
         <td align="center" colspan="3"><input type="submit" name="" value="Upload" class="look"></td>
       </tr>
       </form>
</body>
</html>

保存.php

<?php
$myNewFolderPath=rand();
mkdir($myNewFolderPath);
$fname="full_".uniqid("");
$filename=$fname.'.pdf';
//$uploadpath=SPL_IMG_UPLOADPATH.$filename;
move_uploaded_file($_FILES['img_full']['tmp_name'], $myNewFolderPath.'/'.$filename);
chmod($myNewFolderPath.'/'.$filename, 0777);
echo ('/usr/local/bin/pdftohtml '.$myNewFolderPath.'/'.$filename);
exec('/usr/local/bin/pdftohtml -c -noframes'.$myNewFolderPath.'/'.$filename);
header('Location:'.$fname.'.html');
//exec('/usr/local/bin/pdftohtml 2098602105/EssentialC.pdf');
?>

还有一件事 - pdftohtml 版本是 -0.36

这是截图-

enter image description here

结果 - enter image description here

最佳答案

$ pdftohtml -c source.pdf target.html 

这将以复杂模式输出。您不能将 -noframes 与复杂标志一起使用。

$ man pdftohtml

 -noframes   generate no frames. Not supported in complex output mode.

关于html - 使用 Linux -poppler-utils-pdftohtml 从 pdf 生成带有图像的 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16266896/

相关文章:

HTML/CSS 网页看起来不正常

linux - 如何判断链接器正在使用哪个静态库

linux - 如何更改 U-Boot 内存映射

java - 使用 OCR 的 PDF 文本提取方法

node.js - 如何在pdfkit中使用 'cover'选项?

html - 如何检查我的网站在 Safari 移动版中是否正常运行?

css - 用于组合垂直/内联字段的 Bootstrap 复杂表单布局

linux - Git 从部分存储库中提取?

c# - 如何将 PdfPTable 插入现有的 PDF 模板?

html - 如何在图标旁边添加文本并避免可并行化请求?