ruby-on-railsrubypdfprawn

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. here


Solution

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

    canvas do
      folding_marks
    end