您需要更改ConvertStyleToFont
方法https://doddlereport.codeplex.com/SourceControl/latest#src/DoddleReport.iTextSharp/PdfReportWriter.cs文件以支持Identity_H編碼(Unicode編碼)。 More info here
using DoddleReport;
using iTextSharp.text;
using iTextSharp.text.pdf;
using Font = iTextSharp.text.Font;
namespace Test
{
public class PdfReportWriter // …
{
public static Font ConvertStyleToFont(ReportStyle reportStyle, string fontFamily)
{
var style = Font.NORMAL;
if (reportStyle.Underline)
{
style = Font.UNDERLINE;
}
else if (reportStyle.Bold || reportStyle.Italic)
{
if (reportStyle.Bold && reportStyle.Italic)
{
style = Font.BOLDITALIC;
}
else if (reportStyle.Bold)
{
style = Font.BOLD;
}
else
{
style = Font.ITALIC;
}
}
// todo: to use this method you need to register your fonts at the beginning of the report
// FontFactory.Register(@"c:\windows\fonts\myfont.ttf");
return FontFactory.GetFont(
fontFamily, BaseFont.IDENTITY_H, BaseFont.EMBEDDED,
reportStyle.FontSize, style,
new BaseColor(reportStyle.ForeColor.R, reportStyle.ForeColor.G, reportStyle.ForeColor.B));
}
}
}
或者你可以嘗試http://pdfreport.codeplex.com
請你給我一個代碼示例嗎? –
添加了修改後的方法。 – VahidN