Ruby + Prawn:如何将文字粘贴到页面底部?

时间:2013-12-05 18:40:39

标签: ruby pdf prawn

我的页脚文字需要保留在页面底部:"If you have any questions regarding your order, you may contact us"。我怎么绝对定位呢?

1 个答案:

答案 0 :(得分:1)

以下是from the docs的一种方式:

file = "lazy_bounding_boxes.pdf"
Prawn::Document.generate(file, :skip_page_creation => true) do                    
  point = [bounds.right-50, bounds.bottom + 25]
  page_counter = lazy_bounding_box(point, :width => 50) do   
    text "Page: #{page_count}"
  end 

  10.times do         
   start_new_page
    text "Some text"  
    page_counter.draw
  end
end