Is there a way to adjust the xy coordinates to fit in the bounding box in the prawn pdf if they are larger than the window height?
I use gem 'signature-pad-rails' to capture signatures, which then save the following:
[{"lx":98,"ly":23,"mx":98,"my":22},{"lx":98,"ly":21,"mx":98,"my":23},{"lx":98,"ly":18,"mx":98,"my":21}, ... {"lx":405,"ly":68,"mx":403,"my":67},{"lx":406,"ly":69,"mx":405,"my":68}]
I have the following to show the signature in my pdf:
bounding_box([0, cursor], width: 540, height: 100) do stroke_bounds @witness_signature.each do |e| stroke { line [e["lx"], 100 - e["ly"]], [e["mx"], 100 - e["my"] ] } end end
But the signature in some cases runs off the page, is not the center and just starts up altogether.
ruby-on-rails pdf prawn
Dollarchills
source share