我用的是mac电脑, 一下是我的程序
FontSettings.addFontsFolder("/System/Library/Fonts");
Document pdfDocument = new Document("/Volumes/下载/386.pdf");
// Loop through all the pages of PDF file
for (int pageCount = 1; pageCount <= 4; pageCount++) {
// Create stream object to save the output image
java.io.OutputStream imageStream = new java.io.FileOutputStream("/Volumes/下载/Converted_Image" + pageCount + ".jpg");
// Create Resolution object
Resolution resolution = new Resolution(300);
// Create JpegDevice object where second argument indicates the quality of resultant image
JpegDevice jpegDevice = new JpegDevice(resolution, 100);
// Convert a particular page and save the image to stream
jpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);
// Close the stream
imageStream.close();
}
以下是报的异常
2021-07-08 15:19:48.520 [http-nio-9010-exec-1] ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is class com.aspose.pdf.internal.imaging.coreexceptions.FrameworkException: missing head table —> java.awt.FontFormatException: missing head table
— End of inner exception stack trace —
com.aspose.pdf.internal.imaging.FontSettings.addFontsFolder(Unknown Source)
com.bill.controller.PageController.p2iAsp(PageController.java:145)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:564)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:215)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:142)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
请问 在mac的字库不能识别,只能用windows字库吗?