Search code examples
ruby-on-rails-4wkhtmltopdfwicked-pdf

Wicked pdf gem custom size generating blank screen


I have a method to render a pdf with custom sizes

  format.pdf do
    render pdf: 'layout',
           page_height: 20,
           page_width: 25
  end

It's generating a blank screen with no errors in log

if I remove those parameters (page_height and page_width) it works, but I need that custom size.

Any idea?


Solution

  • I found a solution, changed those numbers to string with units

      format.pdf do
        render pdf: 'layout',
               page_height: "20cm",
               page_width: "25cm"
      end
    

    Their documentation asks for number, but it worked for me like that.