views:

16

answers:

1

I'm generating a PDF using Prince. I'm using the below stylesheet (part of a much larger css file) to include a footer on each page containing page numbers, but the footer doesn't appear.

So the question is, what am I doing wrong?

@page {
  size: A4;
  margin: 24mm 22mm;
  padding: 0;     

 @bottom-left
 {
  content: "Page " counter(page) " of " counter(pages);
  font-size: 7pt;
  font-family: Arial, Helvetica, sans-serif;
  text-align: left;
  white-space:nowrap;
  color:Red;
 }
}
A: 

I discovered the problem. The CSS file I'm using was originally created in VS.Net 2008, but was recently edited in VS.Net 2010, which changed the encoding to UTF-8 with signature. Once I changed the encoding (using File-> Advanced Save Options in VS.Net) to UTF-8 WITHOUT signature the footer appeared correctly in the generated PDF.

Apparently Prince can't handle all of the CSS in a file with an unexpected encoding (or maybe it can't handle a UTF signature?). Long story short - if everything looks Kosher and you're about to lose your mind, check the file encoding.

CodeToaster