简体   繁体   中英

How to open pdf file in wicked_pdf?

Right now im using rail 3.0.0 version.now im generate the pdf file and save that file in public folder using wicked_pdf.now i want open that pdf file using controller action.Im using this code in controller.but it is not working.please help me how to do.

         def download_prescription_pdf 
            pdf_pres = UploadedDocument.find(params[:pdf]) 
            send_file "#{RAILS_ROOT}/public/prescription/#{pdf_pres.file_path}", :type => "application/pdf" 
         end

This works for me:

        render :template  => 'admin/idreport',
               :formats => [:pdf],
               :handlers => [:erb],
               :pdf => "ID List",
               :save_to_file => Rails.root.join('../Documents', "ID List")

Good Luck

Bob

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM