Class: WkPdfRenderer
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- WkPdfRenderer
- Defined in:
- lib/wicked_pdf_standalone/wicked_pdf_standalone.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ WkPdfRenderer
constructor
A new instance of WkPdfRenderer.
- #to_file(output_path, options = {}, &block) ⇒ Object
- #to_html(template_path, options = {}, &block) ⇒ Object
Constructor Details
#initialize(*args) ⇒ WkPdfRenderer
Returns a new instance of WkPdfRenderer.
3 4 5 6 |
# File 'lib/wicked_pdf_standalone/wicked_pdf_standalone.rb', line 3 def initialize(*args) config.assets_dir = Rails.root.join("public") super end |
Instance Method Details
#to_file(output_path, options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/wicked_pdf_standalone/wicked_pdf_standalone.rb', line 12 def to_file(output_path, ={}, &block) = {} [:layout] = .delete(:layout) to_html([:template], , &block) render_with_wicked_pdf({:pdf => 'null', :save_to_file => output_path, :save_only => true}.merge()) output_path end |
#to_html(template_path, options = {}, &block) ⇒ Object
8 9 10 |
# File 'lib/wicked_pdf_standalone/wicked_pdf_standalone.rb', line 8 def to_html(template_path, = {}, &block) @html_string = markup(template_path, , &block) end |