pdf生成,设置中文字体时出错 \simsun.ttc’ with ‘Identity-H’ is not recognized或者type of font{0} is not recognize
错误写法:
PdfFontFactory.createFont(“C:\Windows\Fonts\simsun.ttc”,
PdfEncodings.IDENTITY_H,false);BaseFont.CreateFont(“C:\Windows\Fonts\simsun.ttc”,
PdfEncodings.IDENTITY_H,false)
- 这两种写法是不对的,路径后面加上“,0”就好了
正确写法:
PdfFontFactory.createFont(“C:\Windows\Fonts\simsun.ttc,0”,
PdfEncodings.IDENTITY_H,false);BaseFont.CreateFont(“C:\Windows\Fonts\simsun.ttc,0”,
PdfEncodings.IDENTITY_H,false);