ruby-on-railsherokuprincexmlprincely

<style> Tag ignored by PrinceXML version 15.1


I am upgrading my heroku server stack for a web app that produces PDFs using PrinceXML with Rails. In the upgrade, I have updated princexml to version 15.1. Currently the majority of my styling is included at the top of the body of my .html files using a <style> tag. However, any styling that is contained between my <style>...</style> tags is simply printed into the pdf as text.

The HTML that my app sends to Prince is

<!doctype html>
<html>
  <head>
  </head>
  <body>
    <style type="text/css">
      @page {
      margin: 1.25cm;
      margin-top: 2.5cm;
      }
    </style>

    <div class="pb">
      <div>Some Content below</div>
      <div>...</div>
    </div>
  </body>
</html>

The first line of the PDF is @page { margin: 1.25cm; margin-top: 2.5cm; } and the style is not actually applied.

Any ideas what could be happening here?


Solution

  • The issue I was seeing was a result of the default prince .css files not being in the expected location on my server. Once I moved those .css files, all of my css began to be interpreted again. I found the error by looking at the Prince logging on my server at /app/log/prince.log