gpt4 book ai didi

ruby-on-rails - 在 Rails 应用程序上使用 Prawn gem 重复页脚与当前页面和每页的总页数,但重叠当前页码

转载 作者:行者123 更新时间:2023-12-04 05:44:38 24 4
gpt4 key购买 nike

这是我的代码

repeat :all do
# footer
bounding_box [bounds.left, bounds.bottom + 35], :width => bounds.width do
font "Helvetica"
move_down(15)
number_pages "Page <page> of <total>",
{ :start_count_at => 1, :page_filter => :all,:at => [bounds.right - 50, 0],
:align => :right,
:size => 8}
end
end

并且当前错误结果与当前页码重叠,例如“第 12 页(第 1 和第 2 重叠自身)2”...但最后一页结果类似于“第 2 页,共 2 页”,这是正确的

最佳答案

解决方案是使用 canvas 而不是 repeat :all

这是有效的解决方案:

canvas do
bounding_box [bounds.left, bounds.bottom + 50], :width => bounds.width do
font "Helvetica"
move_down(15)
number_pages "Page <page> of <total>",
{ :start_count_at => 1, :page_filter => :all,:at => [bounds.right - 70, 10],
:size => 8}
move_down(8)
number_pages "This is an automatically generated certificate from BlaBla (blabla.com)", :size => 8, :align => :center,:at => [0, 0]
number_pages "Downloaded on #{Date.today.to_formatted_s(:long)} by #{@user.full_name}", :size => 8, :align => :center,:at => [0, 10]
end
end

关于ruby-on-rails - 在 Rails 应用程序上使用 Prawn gem 重复页脚与当前页面和每页的总页数,但重叠当前页码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31019388/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com