我在macOs上运行官方给的aspose-html示例代码,运行出错,提示Cannot read a name from the name table in a font.
代码如下:
// Source HTML document
com.aspose.html.HTMLDocument htmlDocument = new com.aspose.html.HTMLDocument(documentPath);
// Initialize ImageSaveOptions
com.aspose.html.saving.ImageSaveOptions options = new com.aspose.html.saving.ImageSaveOptions(com.aspose.html.rendering.image.ImageFormat.Jpeg);
// Output file path
// Convert HTML to JPEG
com.aspose.html.converters.Converter.convertHTML(htmlDocument, options, savePath);
出错如下:
Exception in thread "main" java.lang.AssertionError: Cannot read a name from the name table in a font.
at com.aspose.html.internal.ms.System.Diagnostics.Debug.fail(Unknown Source)
at com.aspose.html.internal.p234.z1.fail(Unknown Source)
at com.aspose.html.internal.p127.z26.m201(Unknown Source)
at com.aspose.html.internal.p127.z26.m1563(Unknown Source)
at com.aspose.html.internal.p127.z26.m2(Unknown Source)
at com.aspose.html.internal.p127.z11.m1(Unknown Source)
at com.aspose.html.internal.p127.z11.<init>(Unknown Source)
at com.aspose.html.internal.p127.z8.m1518(Unknown Source)
at com.aspose.html.internal.p127.z8.m1516(Unknown Source)
at com.aspose.html.internal.p127.z8.m123(Unknown Source)
at com.aspose.html.internal.p125.z1.m123(Unknown Source)
at com.aspose.html.internal.p189.z1.m1(Unknown Source)
at com.aspose.html.internal.p189.z1.m1(Unknown Source)
at com.aspose.html.internal.p189.z1.m1(Unknown Source)
at com.aspose.html.internal.p241.z119.m1(Unknown Source)
at com.aspose.html.internal.p252.z20.<init>(Unknown Source)
at com.aspose.html.internal.p241.z119.<init>(Unknown Source)
at com.aspose.html.internal.p241.z65.m1(Unknown Source)
at com.aspose.html.internal.p133.z16$30.m2(Unknown Source)
at com.aspose.html.internal.p133.z16$30.m1(Unknown Source)
at com.aspose.html.internal.p133.z16$6$1.invoke(Unknown Source)
at com.aspose.html.internal.p31.z1.dispose(Unknown Source)
at com.aspose.html.internal.p31.z3.dispose(Unknown Source)
at com.aspose.html.internal.p160.z4.m1(Unknown Source)
at com.aspose.html.internal.p160.z2.m7(Unknown Source)
at com.aspose.html.internal.p174.z7.m2338(Unknown Source)
at com.aspose.html.internal.p174.z7.moveNext(Unknown Source)
at com.aspose.html.internal.p209.z1.m1(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.Renderer.render(Unknown Source)
at com.aspose.html.rendering.Renderer.render(Unknown Source)
at com.aspose.html.converters.z5.m1(Unknown Source)
at com.aspose.html.converters.z5.m1(Unknown Source)
at com.aspose.html.converters.z5.m1(Unknown Source)
at com.aspose.html.converters.Converter.convertHTML(Unknown Source)
at AsposeDocument.html2jpg(AsposeDocument.java:75)
at AsposeDocument.main(AsposeDocument.java:53)
用的是aspose-html 23.1
测试文件内容如下
<p>this is a simple text