I have been following this stack answer for content overflow, from one column to another, The problem i face is, i cannot get the current position of the cursor inside the bounding box. So that i could do calculation to get the remaining height in bounding box and set it to the next text box, currently it overflows the bounding box.
bounding_box([175, starting_y - 240], :width => 30.mm, :height => 67.5.mm) do
transparent(1) { stroke_bounds }
indent 5,5 do
column_box([0, cursor], columns: 1, width: bounds.width) do
text "#{cursor}"
text "XS", align: :center, inline_format: :true
text "XS", align: :center, inline_format: :true
text 'XS', align: :center, inline_format: :true
text 'aaaa', align: :left
text "<b> asda </b>: #{sec_call}", inline_format: true
end
column_box([0, cursor], columns: 5, width: bounds.width, height: 0.27.cm) do
image open('http://ift.tt/2hSZuoh'), width: 0.27.cm
image open('http://ift.tt/2hSZuoh'), width: 0.27.cm
end
column_box([0, cursor], columns: 1, width: bounds.width) do
text "#{care_instr.upcase}"
text "#{imported_for}"
text "CA 17897"
text "FABRIQUE EN CHINE/ HECHO EN"
text "CHINA"
end
# span(bounds.width, position: :left) do
# text_box "#{care_instr.upcase}", at: [180, cursor], overflow: :truncate, :width => 25.mm
# text_box "#{imported_for}", at: [180, cursor-45], overflow: :truncate, :width => 25.mm
# end
span(bounds.width, position: :left) do
text_to_write = text_box text_to_write, at: [180, cursor], overflow: :truncate, :width => 25.mm, :height => 50.5.mm
end
end
end
text_to_write is a long text which needs to be carried to next column which is working fine, sometimes the "#{sec_call}" value increaes so the text to write overlaps/overflows the table, so i need to dynamically change the height so it flows correctly to next column.
Whenever i print cursor inside bounding box it says 0.0, the bounding box height is static and its position also is there any way to calculate the remaining space inside bounding box from current position
Aucun commentaire:
Enregistrer un commentaire