Hi,
I am not able to see the css inside the PDF. the generated pdf will
display in black n white. Am getting images inside the pdf file. Please
see the below code that i have implemented. If anyone finds a solution
please help!
Am using
OS :Ubuntu
Rails: 4.1.8
Ruby :2.1.5p273
Webserver: Unicorn
pdfkit version : 0.6.2
these are my code
initializers/pdfkit.rb
PDFKit.configure do |config|
config.default_options[:quiet] = false
if Rails.env.development?
config.wkhtmltopdf = ‘/mnt/wkhtml/usr/local/bin/wkhtmltopdf’
#can view the PDF in development if the above code is available
end
config.default_options = {
:encoding=>“UTF-8”,
:page_width => “22in”,
:page_height => “34in”,
:margin_top=>“0in”,
:margin_right=>“0.1in”,
:margin_bottom=>“0.25in”,
:margin_left=>“0in”,
:disable_smart_shrinking=> false,
:print_media_type => true
}
end
application.rb
config.middleware.use PDFKit::Middleware, :print_media_type => true
layout.html.erb
<%= stylesheet_link_tag ‘main_stylesheet’, media: ‘all’,
‘data-turbolinks-track’ => true %>
Assets are placed under stylesheets folder in a pdf_print.css
@media print
{
}
Thanks,
Jeff