##Refs
Add to Gemfile: gem 'wicked_pdf'
In terminal: bundle
In terminal: git checkout 6e2d550 /usr/local/Library/Formula/wkhtmltopdf.rb
In terminal: brew install wkhtmltopdf
Make sure you installed wkhtmltopdf 0.9.9
Go to wkhtmltopdf
Download the wkhtmltopdf-0.9.9 Linux Static Binary (amd64) binary
Copy the binary to ``bin/wkhtmltopdf-amd64```
In terminal: brew install qt
Create a file: config/wicked_pdf.rb
if Rails.env.staging? || Rails.env.production?
exe_path = Rails.root.join('bin', 'wkhtmltopdf-amd64').to_s
else
exe_path = Rails.root.join('bin', 'wkhtmltopdf').to_s
# exe_path = '/usr/local/bin/wkhtmltopdf'
end
def show
@model = Model params[:id]
respond_to do |format|
format.html
format.csv do
model_csv = ModelCSV.new(@lesson)
send_data(model_csv.to_csv, filename: model_csv.generate_csv_filename)
end
format.pdf do
render pdf: "#{@model.uuid}",
template: 'admin/modelss/show.pdf.haml',
disposition: 'attachment',
:toc => { :depth => 2, :header_text => 'TEXT', disable_links: false }
end
end
end