Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

column_box, images and bounding_box #421

Closed
gasova opened this Issue Nov 24, 2012 · 9 comments

Comments

Projects
None yet
7 participants

gasova commented Nov 24, 2012

images and bounding_boxes inside column_box are not positioned correctly.
they're always generated at the first column, as they should be at the current column.

Member

yob commented Dec 8, 2012

Thanks for the report. Are you able to provide a short script that demonstrates the issue?

gasova commented Dec 24, 2012

Sorry for my late answer, as soon as possible I will.
Thanks.

Contributor

sgwanlee commented Dec 26, 2012

Hi, the same has occurred to me.
Here's my script

    def question_img
        image Rails.root.join("app/assets/images/#{@question.img}"), width: 200, position: :center
        move_down 20
        # image "http://ohdab.dev/assets/#{@question.img}"
    end

    column_box([0, cursor], :columns => 2, :width => bounds.width) do
        @questions.each do |question|
            @question = question

            text ". " * 100
            move_down 20

            question_img

            text "_ " * 1000
            move_down 20
        end
    end
Member

bradediger commented Jan 3, 2013

@gasova: #431 was merged today. Can you try the master branch and determine if it fixes your problem? Thanks!

gasova commented Jan 3, 2013

yes sure I will be able to do it on this week-end, an let you know. I'm developing the site mgkmedya.com, and used prawn for the posts renderıng to pdf.

Kınd regards.

Your gem is really great.

PS: Sorry if I couldn't give you a ready code on time. thanks to sgwanlee he'd made it.

Contributor

jordanbyron commented Mar 8, 2013

Seems to be working now. Using a slightly modified version of the example above:

data = [["foo","bar"]] * 31

pdf = Prawn::Document.new do
  column_box([0, cursor], :columns => 2, :width => bounds.width) do
    data.each do |question|
      text ". " * 100
      move_down 20

      image File.join(File.dirname(__FILE__), 'data', 'images', 'arrow.png'),
        width: 42, position: :center
      move_down 20

      text "_ " * 1000
      move_down 20
    end
  end
end

PDF Result

Member

bradediger commented Mar 8, 2013

Thanks @jordanbyron. Closing.

@bradediger bradediger closed this Mar 8, 2013

Saidbek commented Apr 20, 2014

having the same issue, images are shown just on the left side, using

column_box([0, cursor], columns: 2, width: bounds.width, reflow_margins: true) do
  @conclusion.assets.each do |f|
    image f.picture.path, width: 260, height: 170
    move_down 10
  end
end
Owner

practicingruby commented Apr 20, 2014

@Saidbek Please provide me an image to test this with that reproduces the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment