about 11 years ago
This library is used to create pdf from html.
Steps to install:
#Install wkhtmltopdf library in ruby by using below command:
#Use below command to find the path. This path need to add in in pdfkit.rb[in initializers folder]
Once wkhtmltopdf installed then 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**
**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:
- 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
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
This will resolve the above problem
0 Comment(s)