简体   繁体   中英

Unable to generate pdf using wicked gem

I tried using

render pdf: "users/user_information"

But I am unable to render it. I looked into the documentation as well but all in vain. Can anyone please tell me what am I doing wrong here?

In the pdf: you have to mention the file name you want it to have on downloading.

format.pdf do render pdf: "file_name" # Excluding ".pdf" extension. end

Documentation - Basic Usage

As far as I have understood I guess you're using your own template from the view. You can use this.

render pdf: "User_#{@user.id}", template: 'users/user_information', layout: 'application'

Layout can be mentioned if you want the layout of the application, otherwise just skip it.

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