Here is my code

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

and the current error result is overlapping of current page number, like "Page 12(1 and 2 overlaps on itself) of 2" ... but on last page result is like "Page 2 of 2" which is correct

1

There are 1 answers

0
Nirajan Pokharel On BEST ANSWER

The solution is to use canvas instead of repeat :all

Here is the working solution:

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