Ruby 对虾模板不起作用

Ruby 对虾模板不起作用,ruby,pdf,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') 在与脚本相同的目录中有一个tem

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

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仅随Hello Wordl一起提供

还有什么我应该关心的吗


谢谢

模板仅在中介绍,如Daniel Nelson所述。

如果您想在pdf文件上加盖印章,并且您正在使用Ubuntu,请尝试安装pdftk

转到终端并键入以下内容:

sudo apt-get install pdftk
然后转到pdf目录并键入:

pdftk content.pdf stamp template.pdf output final.pdf
如果您想在Ruby中实现这一切,您可以了解:


我在这个链接中读到了这个解决方案:

我有对虾0.12.0,我也遇到了同样的问题。