0

I am adding a CSS stylesheet to my PDF creation with iTextSharp.

My code looks like this:

var css = XMLWorkerHelper.GetCSS(new FileStream(HttpContext.Current.Server.MapPath(linkCss), FileMode.Open));
cssResolver.AddCss(css);

And my CSS is simple like this:

.test-class {
    color: orange;
}

However, when I add this style sheet, it is not being applied. I dug into the CSSFileWrapper private properties while debugging, and noticed the key/value generated for .test-class actually had a key of .test-class

For whatever reason, the first (and only first) CSS class in the stylesheet has those strange characters at the beginning of the key name. The rest of the styles in the parsed document are correct. Right now, I just added a dummy class at the beginning to account for this, but I feel there is some other underlying issue.

Does anyone know what would cause this?

Brandon
  • 10,744
  • 18
  • 64
  • 97
  • Probably your css file actually had those characters up front. Maybe those are Unicode byte order marks (which generally are not displayed) or something similar. – mkl Nov 02 '13 at 18:37
  • I fail to see how this is a duplicate when the answer you reference is for PHP and this is for C#/.NET... unless I'm missing something? – azarc3 Aug 19 '14 at 18:09

0 Answers0