How to get the final position of a text to position a new one in Prawn

Viewed 67

I have two user typed refereed texts that are placed one below the other and I'm using prawn gem to generate pdf and I position my code as follows:

# show.pdf.prawn
...
pdf_notes_1 = firt_text # firt_text is an arbitrary text body of the user
pdf_notes_2 = second_text # second_text is an arbitrary text body of the user

# firt text 
pdf.bounding_box [0, 5], width: 300 do
  pdf.table(pdf_notes_1, cell_style: { borders: [] }) do
    cells.padding = 0
  end
end   

...

pdf.bounding_box [0, end_position_pdf_notes_1], width: 300 do
  pdf.table(pdf_notes_2, cell_style: { borders: [] }) do
    cells.padding = 0
  end
end  

....

I want to find the end of the user's first arbitrary text position so I can place it in the other user text position in "end_position_pdf_notes"

For example, if user writte a text and its end in position: [0, 10], then the new text will have position:

  end_position_pdf_notes: 11 
 "pdf.bounding_box [0, end_position_pdf_notes_1]"
0 Answers
Related