In rails 4, I am using grape
gem for mobile app features. In mobile app, I need to provide download .pdf
file option. I have referred this How to allow Binary File download using GRAPE API but file is not generating here.
Other than mobile app(in web side) I have downloading a file using,
file_path = "#{Rails.root}/public/downloads/#{@user.id}_guide.pdf"
pdf = WickedPdf.new.pdf_from_string(render_to_string('public/guide/template', :layout=> false))
File.open(file_path, 'wb') do |file|
file << pdf
end
return file_path
Please help me to write an API which generates and downloads a .pdf
file