This library is used to create pdf from html.
Steps to install:
#Install wkhtmltopdf library in ruby by using below command:
apt-get install wkhtmltopdf
#Use below command to find the path. This path need to add in in pdfkit.rb[in initializers folder]
which wkhtmltppdf
Once wkhtmltopdf installed then install Pdfkit
    gem install pdfkit
If pdfkit.rb is not present in initializers folder then create it with following content
 **PDFKit.configure do |config|
config.wkhtmltopdf = '/usr/bin/wkhtmltopdf'
config.default_options = {
:page_size => 'A4',
:print_media_type => true
}
end**
Note: If you get any error like [BROKEN PIPE] Then
   please follow following steps:
- remove wkhtmltopdf
 
- then install wkhtmltopdf with following steps:
  login as root  
  wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
  tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
  mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
  chmod +x /usr/local/bin/wkhtmltopd
Again run this command
  which wkhtmltppdf          #to find the path. This path need to add in in pdfkit.rb[in initializers folder]
  Set path in pdfkit.rb[in initializers folder]
This will resolve the above problem
                       
                    
0 Comment(s)