Created
March 3, 2023 07:57
-
-
Save joaopfsilva/22fb8ced2e187838e80f43f086ff4520 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# require gem wicked-pdf | |
# create a pdf from a string | |
pdf = WickedPdf.new.pdf_from_string('<hI>Hi Ruby! I am WickedPdf</h1>') | |
# save the pdf file | |
File. open(save_path, 'w') do |file| file << pdf end | |
# if you want to return a pdf from controller | |
pdf = WickedPdf.new.pdf_from_string('<h1>Hi Ruby! I am WickedPdf Gem</h1>') | |
send_data pdf, filename: 'filename.pdf' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment