I have an rails 5.2 app and its about generating a pdf files.
I am using pdf doc as template and generating new temp pdf and with pdf-toolkit doing merging of these two to a final pdf file.
This are file paths in development:
template_file = File.join(Rails.root, "lib/ams1035.pdf")
prawn_file = File.join(Rails.root, "lib/temp.pdf")
output_file = File.join(Rails.root, "public/pdfs/ams1035-#{@income.id}.pdf")
and this are on production server:
template_file: /home/deploy/ss.info/releases/20180808154901/lib/ams1035.pdf
prawn_file: /home/deploy/ss.info/releases/20180808154901/lib/temp.pdf
output_file: /home/deploy/ss.info/releases/20180808154901/public/pdfs/ams1035-2.pdf
Locally in development on button click pds is generated and created in public/pdfs/
but on production never seeing any pdf file is generated.
If I upload manually file on location, click opens pdf correctly.
Questio: do I missing something or do I need to add some permissions to public/pdfs
folder for prawn/pdf-toolkit so they can create file on location?
Problem was I need it to install pdftk manually on my server Ubuntu 16.04. Logged on with ssh and run:
sudo apt-get update
sudo apt-get install pdftk
Instructed from: https://www.howtoinstall.co/en/ubuntu/xenial/pdftk