Wrap text around an image in rails and prawn

Posted by stevenheidel on Stack Overflow See other posts from Stack Overflow or by stevenheidel
Published on 2010-04-22T16:39:23Z Indexed on 2010/04/22 16:43 UTC
Read the original article Hit count: 409

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.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails