【问题标题】:how to set the total number of pdf's pages to be generated by using HTMLDoc?如何设置使用 HTMLDoc 生成的 pdf 页面总数?
【发布时间】:2010-09-15 16:14:24
【问题描述】:

我正在使用 HTMLDoc 生成 pdf 文件。但我想生成两页的pdf文件。 其中第一页应该有图像,第二页将包含 HTML 文件内容。目前我正在使用此代码生成 pdf 文件。它只生成一页的 pdf 文件,我的所有内容和图像都只出现在单页上。这是我的代码。

cmd = "htmldoc --webpage --color --no-toc --footer ... #{@size ? ' --size ' + @size : ''} #{@body_image ? ' --bodyimage ' + @body_image : ''} #{@margins && @margins.size == 4 ? ' --top ' + @margins[0] + ' --right ' + @margins[1] + ' --bottom ' + @margins[2] + ' --left ' + @margins[3] : ''} -f #{@pdf_file} #{html_file}  2>&1"

提前致谢。 高拉夫·索尼

【问题讨论】:

  • 我认为这里的“ruby on rails”标签不正确。
  • 这是我在应用程序及其运行中使用的代码部分。

标签: pdf-generation htmldoc


【解决方案1】:

来自HTMLDOC manual

HTMLDOC 支持许多特殊的 HTML cmets 来启动分页、设置页眉和页脚文本以及控制当前的媒体选项。

所以看起来你应该在你需要分页符的地方将这个特殊的注释插入到你的 HTML 源代码中:

<!-- PAGE BREAK -->

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-29
    • 2014-03-21
    • 1970-01-01
    • 2012-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多