Search code examples
ruby-on-railsrubyrubygemsgrover

Grover.to_pdf: ReadableStream is not defined


I have a Rails app that is using the Grover Ruby gem, and it converts HTML to images perfectly well, but when I try to convert it to a PDF as shown below, I get an error saying the ReadableStream is not defined.

html = ExportController
        .new
        .render_to_string({
                            template: '/export/index',
                            layout: 'pdf'
                          })
pdf = Grover.new(html).to_pdf
send_data pdf, filename: 'export', type: 'application/pdf'

I suspected that this had something to do with the dependencies, but they were all the proper versions and appeared to have no conflicts. I checked the GitHub issues, and there was nothing matching this problem, so I think it's something on my end, but I can't pinpoint it.


Solution

  • Grover requires a config file, and it isn't added by default. Adding it fixed the problem for me. The github page has a good example config here.