ruby - Prawn 模板不起作用

标签 ruby pdf prawn

我正在尝试这个简单的脚本:

require 'prawn'

template_file_name = File.join(File.dirname(__FILE__), 'template.pdf')
pdf_file = Prawn::Document.new(:template => template_file_name)
pdf_file.text('Hello World')
pdf_file.render_file('output.pdf')

与脚本相同的目录中有一个 template.pdf 文件,但 output.pdf 仅附带 Hel​​lo Wordl

还有什么我应该关心的吗?

谢谢

最佳答案

模板仅在 prawn 0.10.1 中引入正如丹尼尔·尼尔森所述here .

关于ruby - Prawn 模板不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4792954/

相关文章:

ruby - 使用 Ruby 向 Azure 进行身份验证(HTTP header 身份验证)?

windows - 将带有希腊文本的 .Rnw 编译为 pdf

c++ - 使用 PoDoFo 获得的字符位移不正确

ruby-on-rails - 将 Prawn 与 Rails 应用程序一起使用 : Send generated pdf file to user's downloads folder instead of app directory

ruby-on-rails - 使用基类与基模块重构 ActiveRecord 模型

ruby - 为将来的 gem 安装设置 RVM,以获得正确的权限并正确添加 PATH

ruby - 从另一个符号数组填充一个新数组

ruby-on-rails - 在 Prawn 中使用列表

ruby - 为什么 YAML::Load 工作,但使用 require 的相对路径不工作

java - iText - 如果有可用空间,则在最后一页末尾添加表格