Alan Coromano
Alan Coromano

Reputation: 26048

Padding left for a text in Prawn

I want to make a certain block of a text (not a whole document) "have a left padding". I could say:

text_box "some text", :at => [200, 100]

But that's not I'm looking for because it specifies x and y as the paddings, whereas I want to specify only x.

How do I do that?

Upvotes: 4

Views: 4120

Answers (2)

Anton Kachan
Anton Kachan

Reputation: 387

You can do this:

indent(10, 15) do # left and right padding
  text "Some text"
end

Upvotes: 8

André Herculano
André Herculano

Reputation: 1307

I can't test it right now, but you can try something like this:

text_box "some text", :at => [200, cursor]

Where cursor is a method which returns the cursor y position.

I hope it helps.

Upvotes: 2

Related Questions