Question

I want to draw a simple horizontal rule. What I'm doing is:

move_down 30
horizontal_rule

and Gemfile

gem 'prawn', :git => "https://github.com/prawnpdf/prawn.git", branch: 'master' 

It doesn't draw anything.

Was it helpful?

Solution

You need to call horizontal_rule inside a stroke do block, i.e.

stroke do
  move_down 30
  horizontal_rule
end

Alternatively you can call the method, stroke_horizontal_rule.

move_down 30    
stroke_horizontal_rule

If you want to use other options such as color, width etc I think you have to do it in the block...

stroke do
  stroke_color 'ff0000'
  dash(5, space: 2, phase: 0)
  line_width 10
  stroke_horizontal_rule
  move_down 15
  horizontal_line(0, 540)
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top