Hi,
This works at windows 7 when Format (in Region and Language of control panel) set to both English / Chinese (Simplified, PRC), but it throws NullReference exception at only Windows 10 with Chinese Format for Region.
and it works in Window 10 with English format.
This is codes where exception thrown:
var page = new ceTe.DynamicPDF.Page(PageSize.Letter, PageOrientation.Landscape, 20);
This happens to v7.0.1 too.
Any ideas? Help!!
Help! Exception when instantiate a new Page object
Re: Help! Exception when instantiate a new Page object
Forum member · Jan 25, 2017We found null returned from Font.LoadSystemFont("Microsoft YaHei").
It works at win 7 with Chinese format, but windows 10. Odd. Any suggestions? Thx!
Re: Help! Exception when instantiate a new Page object
Support · Jan 30, 2017Hello,
Open Type Font (OTF) and True Type Font (TTF) are the two font types the LoadSystemFont supports. The LoadSystemFont method of Font class will return Null object if the specified font is not installed or if the font type available on that system is of an unsupported font type.
Please double check and make sure that the Microsoft YaHei font installed on both machines (Windows 7 and Windows 10) is either an Open Type (OTF) or True Type (TTF) font.
The DynamicPDF API supports TTF and OTF fonts and if your Win 10 system has TTC (True Type Font Collection) font type then you may get the null reference exception because currently DynamicPDF API does not supports TTC font type.
In this case you may want to consider deploying your own font file (TTF or OTF) with your application. You can load that font file using the OpenTypeFont
class as shown below.
OpenTypeFont font = new OpenTypeFont("MicrosoftYaHei.ttf");
Thanks,
ceTe Software Support Team.