Sha256: cd0186f2c065b847b2156d5acdde9f2f6105e21f076e8cf6d6f6579f4ab1ecb8

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

wicked_pdf_conf = "#{@project_path}/config/initializers/wicked_pdf.rb"

return say('Wicked_pdf already installed', :red) if File.exists?(wicked_pdf_conf)

add_gem 'wicked_pdf'
add_gem 'wkhtmltopdf-binary'
run 'bundle install'
run 'rails generate wicked_pdf'

instructions = <<-TXT
INSTRUCTIONS:
Quick test: add 'render pdf: "file_name"' to your controller action
(show action is usually the easiest bet) )

More advanced example:
  footer_html = render_to_string('offers/footer.html.erb', layout: 'layouts/pdf.html')
  header_html = render_to_string('offers/header.html.erb', layout: 'layouts/pdf.html')
  body_html = render_to_string('offers/print.html.erb', layout: 'layouts/pdf.html')

  pdf = WickedPdf.new.pdf_from_string(
          body_html,
          header: {content: header_html, spacing: 5},
          footer: {content: footer_html},
          page_size: 'A4',
          margin: {top: 25, bottom: 45, left: 10, right: 10},

  )
  send_data pdf, filename: "offer_number.pdf",
            type: 'application/pdf',
            disposition: 'inline'

FOR MORE INFORMATION: https://github.com/mileszs/wicked_pdf
TXT

say instructions, :green
say "For server - find binary with which wkhtmltopdf and used it as exe_path in config/initializers/wicked_pdf.rb", :red


Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
r5-0.5.0.0 lib/r5/recipes/wicked_pdf.rb
r5-0.4.0.5 lib/r5/recipes/wicked_pdf.rb
r5-0.4.0.4 lib/r5/recipes/wicked_pdf.rb
r5-0.4.0.2 lib/r5/recipes/wicked_pdf.rb
r5-0.4.0.1 lib/r5/recipes/wicked_pdf.rb
r5-0.4.0.0 lib/r5/recipes/wicked_pdf.rb
r5-0.3.0.0 lib/r5/recipes/wicked_pdf.rb
r5-0.2.6.2 lib/r5/recipes/wicked_pdf.rb
r5-0.2.6.1 lib/r5/recipes/wicked_pdf.rb
r5-0.2.6.0 lib/r5/recipes/wicked_pdf.rb
r5-0.2.5.2 lib/r5/recipes/wicked_pdf.rb