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.
它没有任何吸引力。
1 个解决方案
#1
27
You need to call horizontal_rule inside a stroke do block, i.e.
你需要在stroke do block中调用horizontal_rule,即
stroke do
move_down 30
horizontal_rule
end
Alternatively you can call the method, stroke_horizontal_rule
.
或者,您可以调用方法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
#1
27
You need to call horizontal_rule inside a stroke do block, i.e.
你需要在stroke do block中调用horizontal_rule,即
stroke do
move_down 30
horizontal_rule
end
Alternatively you can call the method, stroke_horizontal_rule
.
或者,您可以调用方法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