PDFKit ignoring CSS

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"

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