def show
respond_to do |format|
format.html {}
format.pdf do
html = render_to_string(
template: 'sales/show.pdf.erb',
page_size: 'A4',
margin: { bottom: 25 },
footer: {
content: render_to_string('shared/footer')
}
layout: 'layouts/application.pdf.erb')
pdf = WickedPdf.new.pdf_from_string(html)
send_data(pdf, filename: "sale-#{@sale.our_ref}.pdf", type: 'application/pdf',
disposition: :attachment)
end
end
end