我们需要转换/提供基于html的应用程序内HelpSystem到光盘上的pdf,以便客户端在应用程序外部查看。
我正在尝试将wkhtmltopdf
与一个非常基本的文件(3个框架链接到简单的.html文件)一起使用,但是当我从命令行运行以下内容时获取空.pdf
:< / p>
wkhtmltopdf "C:\Program Files (x86)\wkhtmltopdf\index.html" "c:\delme\test.pdf"
我知道框架有些不赞成,但这是我必须要处理的。帧是否导致空pdf?
的index.html:
<html>
<head>
<title>Help</title>
</head>
<frameset cols="28%, 72%">
<frameset rows="8%, 92%">
<frame noresize="noresize" src="Buttons.html" name="UPPERLEFT" />
<frame noresize="noresize" src="mytest2.html" name="LOWERLEFT" />
</frameset>
<frame noresize="noresize" src="mytest.html" name="RIGHT" />
</frameset>
</html>
mytest.html:
<html>
<body>
<p>
<b>This text is bold</b>
</p>
<p>
<strong>This text is strong</strong>
</p>
<p>
<em>This text is emphasized</em>
</p>
<p>
<i>This text is italic</i>
</p>
<p>
<small>This text is small</small>
</p>
<p>This is
<sub>subscript</sub> and
<sup>superscript</sup></p>
</body>
</html>
mytest2.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h2>The blockquote Element</h2>
<p>The blockquote element specifies a section that is quoted from another source.</p>
<p>Here is a quote from WWF's website:</p>
<blockquote cite="http://www.worldwildlife.org/who/index.html">For 50 years, WWF has been protecting the future of nature. The
world’s leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United
States and close to 5 million globally.</blockquote>
<p>
<b>Note:</b> Browsers usually indent blockquote elements.</p>
<h2>The q Element</h2>
<p>The q element defines a short quotation.</p>
<p>WWF's goal is to:
<q>Build a future where people live in harmony with nature.</q> We hope they succeed.</p>
<p>
<b>Note:</b> Browsers insert quotation marks around the q element.</p>
</body>
</html>
buttons.html:
![<html>
<body>
<center>
<table>
<tr>
<td>
<form method="link" action="mytest.html" target="LOWERLEFT">
<input type="submit" value="Contents" />
</form>
</td>
<td>
<form method="link" action="mytest2.html" target="LOWERLEFT">
<input type="submit" value="Index" />
</form>
</td>
</tr>
</table>
</center>
</body>
</html>][2]
答案 0 :(得分:0)
取自the official wkhtmltopdf
issues area代码项目成员的回答;重点是我的:
wkhtmltopdf根据H *计算TOC(例如H1,H2等) 提供的文档中的标记。 它没有递归到帧和 iframes .. 它将依赖于数字,以确保它 做正确的事,确保你只有 标签下的标签,而不是更大的k 然后1. 2000+文件听起来很多。你可能会用完内存 转换输出时。如果它不适合你..你可以 尝试使用开关将大纲转储到xml文件,看看它是什么 但是会进入TOC。