2016-12-26 70 views
4

我如何繪製邊框邊框與特定的設置不能得出邊框邊框對蝦

bounding_box([175, starting_y - 190], :width => 30.mm, :height => 17.mm) do 
    stroke_color 'FFFF00' 
    dash 10, space: 4 
    stroke_bounds 
end 

我想有邊框點綴單獨底,我怎麼有這個?

我試着在行程搜索,stroke_bounds,對蝦文件bounding_box,我找不到任何

+0

你只需要一條虛線,還是3條連續線和1條虛線? –

回答

1

您可以單獨繪製線條:

require "prawn" 

Prawn::Document.generate("bbox.pdf") do 
    x = 175 
    y = 200 
    width = 100 
    height = 50 
    color = 'FFFF00' 

    stroke do 
    stroke_color color 
    vertical_line y, y+height, :at => x 
    vertical_line y, y+height, :at => x+width 
    horizontal_line x, x+width, :at => y+height 
    end 

    stroke do 
    stroke_color color 
    dash 10, space: 4 
    horizontal_line x, x+width, :at => y 
    end 
end 

它輸出

enter image description here