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

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fa3943df378f9447779ea20333bc4f1d%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to