Reputation: 49371
All the documentation for wicked_pdf
assume you are using rails
.
But I want to use this feature in a non-rails environment (a Jekyll plugin, written in Ruby).
Trying to use pdf = WickedPdf.new.pdf_from_string(page.content)
returns Error: uninitialized constant WickedPdf
.
How do I initialize WickedPdf
without the rails generate wicked_pdf
provided in their documentation?
Upvotes: 2
Views: 307
Reputation: 4193
wicked_pdf depends on active_support/core_ext
- as you can see in lib/wicked_pdf.rb. However you can use it outside of controller "context" like this...
pdf = WickedPdf.new.pdf_from_string('<h1>My life is wicked.</h1>')
Upvotes: 1
Reputation: 49371
I had to add gem 'activesupport'
to my gemfile, then use require 'wicked_pdf'
in my source code.
Upvotes: 1