简体   繁体   中英

Prawn the horizontal line from the left border/edge in PDF

I use gem prawn to generate pdf file. I want to have horizontal line 105 mm from top, 1pt line, #000 . I've set left margin and top margin (I need it in the rest of the pdf) as follow:

LEFT_MARGIN = 25.mm
TOP_MARGIN = 44.mm

  def folding_marks
    stroke_color '#000'
    stroke_horizontal_line(0, 100, at: TOP_MARGIN + 61.mm)
  end

How to skip the left margin to have the line start right on the left edge?

If I just simply remove the LEFT_MARGIN I'll have a horizontal line not from the left edge but still with some kind of margin. 这里

You need to use the #canvas method to temporarily reset the bounding box to the full page:

canvas do
  folding_marks
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM