ruby-on-railspdfprawn

Rails gem prawn - undefined method `[]' for Float in horizontal line with a specific location


I'm using Prawn gem to generate the PDF file (A4 format). I want to have two horizontal lines/folding marks which should be available: 105 mm from top of the document, 1pt line, #000. From what I know I could call something like:

stroke_horizontal_line(0, 1, 105.mm)

But I'm getting an error:

NoMethodError (undefined method `[]' for 297.6377952755906:Float):

(eval):2:in `stroke_horizontal_line'

Solution

  • I believe stroke_horizontal_line expects the third argument to be a hash. You need to include the key before the data.

    stroke_horizontal_line(0, 1, at: 105.mm)