Tag:

当使用repeat(:all)时,Prawn似乎没有推动布局

我正在生成一个文档,其中包含流入每个后续页面的数据,每个页面都有一个标准标题。 但是,当我使用repeat(:all)将标题放在每个页面上时,我发现除了第一页之外的每个页面上,下一个内容都没有按照我放在页面上的标题横幅的大小向下移动。 我生成横幅的代码: class SmartsoftPdf 40 draw_text text, :at => [80,25], :size => 12, :style => :bold, :color => BLUE draw_text “Date: #{ausDate(date)}”, :at => [bounds.right – 100,bounds.top – 15], :size => 10 if date end end def header_box(&block) bounding_box([-bounds.absolute_left, cursor + BOX_MARGIN + 8], :width => bounds.absolute_left + bounds.absolute_right, :height => BOX_MARGIN*2) do fill_color […]

铁轨gem虾,图像和锚

你能告诉我如何插入图像,这将是一个链接,例如第20页? 我知道如何使用普通文本: text “Go to page 20”, :inline_format=>true 然后在第20页我有 add_dest(‘page20’, dest_fit(page.dictionary)) 但如何用图像做到这一点?

Prawn pdf附件在电子邮件中

在我的Rails应用程序中,我正在尝试将发票附加到电子邮件中: def invoice(invoice) attachment :content_disposition => “attachment”, :body => InvoicePdf.new(invoice), :content_type => “application/pdf”, :filename => ‘invoice.pdf’ mail(:to => @user.email, :subject => “Your Invoice”) end InvoicePdf是一个Prawn PDF文档: class InvoicePdf < Prawn::Document def initialize(order, view) draw_pdf end def draw_pdf # pdf stuff end end 我在电子邮件中没有附件。 我究竟做错了什么? 任何提示都会受到欢迎和赞赏。 编辑:我使用的Rails版本是3.0.x.