Ruby on Rails Saturday, December 13, 2014

I've narrowed down my issue to what I think is the initializer. Basically, when I add ".pdf" to a url I get a CSS styled page on Heroku, but when I add @media print { } it has no effect on the page.

Here is my initializer pdfkit.rb:

ActionController::Base.asset_host = Proc.new { |source, request|      if request.env["REQUEST_PATH"].include? ".pdf"      "file://#{Rails.root.join('public')}"    else      "#{request.protocol}#{request.host_with_port}"    end  }

Here is my CSS:

@media print {      #scores table tr td, #scores table tr th {      page-break-inside: avoid !important;    }      table, tr, td, th, tbody, thead, tfoot {      page-break-inside: avoid !important;    }   }
I think it's not recognizing the .pdf as "print" CSS

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ce95e073-ed11-4917-a684-f334975040c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment