I am trying to make a flyer creator app and am having a hard time getting the page to save as a pdf.
After doing a bit of googling I found a couple options and landed on pdfkit. The rails casts video made it look very simple, then like always, being on a windows machine, I found it didn't exactly apply. I have tried a ton of tutorials but am still unable to get my local environment working.
I eventually would like to deploy this solution to heroku and that seams to also require some extra steps.
My gems include,
gem "pdfkit"
my application.rb includes
config.middleware.use "PDFKit::Middleware", :print_media_type => true
I have in my /config/initializers I have pdfkit.rb that contains
PDFKit.configure do |config|
config.wkhtmltopdf = 'C:/wkhtmltopdf/bin/wkhtmltopdf.exe'
config.default_options = {
:page_size => 'Legal',
:print_media_type => true
}
end
Is there anything else needed I may have missed?
I have seen the gem "wkhtmltopdf-binary" referenced in some tutorials, do I need this gem? what is it doing?
I have installed the wkhtmltopdf application all over my computer at this point, I saw one tutorial that placed the install in the actual root of the app, in the root of my C: drive and elsewhere. Even when I think I got this part right at best I got the message
"Exit with code 1 due to network error: ContentNotFoundError"
I would really like some help getting PDFKit to work on my local environment, and then deploy that solution to heroku. Can anyone help?
I can show any code snippets needed I am just unsure what would be helpful.
In case it helps anyone here is a link to my work in progress site / an example page that I would like turned into a pdf.
http://www.easyflyerceator.com/carpet_cleaning_flyers/1/carpet_cleaning1s/4
pdftk
with heroku and it requires a custom build pack to actually create the application on the server. Also you might want to look atwicked_pdf
I have heard good things when converting html to a pdf. Finally have you tried dropping theC:
portion of the path because/
means root. – engineersmnky