项目中需要把silverlight page转化为pdf,html. pdf 已经工作,html有个bug, 当页面中有中文时会出现乱码。
string html = GetHtml(card, properties, propertyColumns, labels, labelColumns, enforcements, enforcementColumns, listings, listingColumns, products, productColumns, aliases, aliasColumns);
Stream s = fsd.OpenFile();
byte[] data = System.Text.Encoding.UTF8.GetBytes(html);
s.Write(data, 0, data.Length);
解决办法是在html中加入<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8 ">