1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > Font\隶书\“ is not available to the JVM See the Javados for more details

Font\隶书\“ is not available to the JVM See the Javados for more details

时间:2023-11-04 04:10:59

相关推荐

Font\隶书\“ is not available to the JVM See the Javados for more details

这个报错的意思是JVM无法识别字体引起的错误。所以我们要把所需要的字体注册到JVM去。

依赖包

<dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.7.22</version></dependency>

代码:放到要执行打印前的前面就行了

BufferedInputStream inputStream = FileUtil.getInputStream(new File("C:\\Users\\lzyy\\Desktop\\SIMLI.TTF"));Font font = null;font = Font.createFont(Font.TRUETYPE_FONT, inputStream);font = font.deriveFont(Font.PLAIN, 20);GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font);

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。