Wrap text around an image in rails and prawn
- by stevenheidel
I have a document with dynamic image and dynamic text and would like the text around the image. The image is right aligned on the landscape page. Here is what I have so far:
pdf.bounding_box([0,pdf.bounds.top - 50], :width => pdf.bounds.width, :height => pdf.bounds.height-50) do
pdf.text @article.title, :size => 30, :style => :bold
pdf.text @article.content, :align => :left
# image
pdf.bounding_box([pdf.bounds.right - 250, pdf.bounds.top], :width => 250, :height => 250) do
pdf.image image_path, :width => 250
end
end
The text goes right underneath the image. I tried doing this http://stackoverflow.com/questions/2085151/ruby-prawn-how-to-wrap-text-around-an-aligned-right-image but it didn't work.
Help is appreciated, thanks.