Module: FerrumPdf::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ferrum_pdf/controller.rb
Instance Method Summary collapse
- #render_pdf(pdf_options: {}, **rendering) ⇒ Object
- #render_screenshot(screenshot_options: {}, **rendering) ⇒ Object
Instance Method Details
#render_pdf(pdf_options: {}, **rendering) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ferrum_pdf/controller.rb', line 5 def render_pdf(pdf_options: {}, **rendering) content = render_to_string(**rendering.with_defaults(formats: [ :html ])) FerrumPdf.render_pdf( html: content, host: request.base_url + "/", protocol: request.protocol, pdf_options: ) end |
#render_screenshot(screenshot_options: {}, **rendering) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ferrum_pdf/controller.rb', line 16 def render_screenshot(screenshot_options: {}, **rendering) content = render_to_string(**rendering.with_defaults(formats: [ :html ])) FerrumPdf.render_screenshot( html: content, host: request.base_url + "/", protocol: request.protocol, screenshot_options: ) end |