PDFBox EOFException:设置文本字段值时为空
PDFBox EOFException: null when setting textfield value
我正在尝试填写一张用 adobe acrobat 创建的 pdf 表单,该表单包含一个名为 'txt_name' 的文本字段。填写表格我使用的是 Apache PDFBox。
填写pdf表格的代码
try {
PDDocument pDDocument =
Loader.loadPDF(ResourceUtils.getFile("classpath:pdf/test.pdf"));
PDAcroForm pDAcroForm = pDDocument.getDocumentCatalog().getAcroForm();
pDAcroForm.getField("txt_name").setValue("test");
pDDocument.save("./src/main/resources/pdf/generated/test.pdf");
pDDocument.close();
} catch (IOException e) {
e.printStackTrace();
}
如您所见,我正在加载名为 'test.pdf' 的 pdf 文件。在此之后,我想用名称 'txt_name' 填写字段并将值设置为 'test',但是当我尝试填写该字段时,我得到一个 EOFException.我也收到错误 'Could not load font file: C:\WINDOWS\FONTS\mstmc.ttf'。我的计算机上没有此文件,但当我尝试在网上查找有关此文件的任何信息时,我没有得到任何好的结果。
PDFBox 版本:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>3.0.0-RC1</version>
</dependency>
我也尝试了不同的版本,但这行不通。
堆栈跟踪:
2021-05-19 10:46:22.549 WARN 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : New fonts found, font cache will be re-built
2021-05-19 10:46:22.550 WARN 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : Building on-disk font cache, this may take a while
2021-05-19 10:46:22.833 ERROR 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : Could not load font file: C:\WINDOWS\FONTS\mstmc.ttf
java.io.EOFException: null
at org.apache.fontbox.ttf.TTFDataStream.readUnsignedInt(TTFDataStream.java:150) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.fontbox.ttf.TTFParser.readTableDirectory(TTFParser.java:298) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:139) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:87) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFont(FileSystemFontProvider.java:630) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:374) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:350) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:135) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:154) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:418) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFontBoxFont(FontMapperImpl.java:381) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.getFontBoxFont(FontMapperImpl.java:355) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:146) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.PDType1Font.<clinit>(PDType1Font.java:63) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processSetFont(PDDefaultAppearanceString.java:169) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processOperator(PDDefaultAppearanceString.java:132) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processAppearanceStringOperators(PDDefaultAppearanceString.java:109) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.<init>(PDDefaultAppearanceString.java:87) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaultAppearanceString(PDVariableText.java:93) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.<init>(AppearanceGeneratorHelper.java:115) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:261) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:210) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:218) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at welledmedia.backend.services.QuotationService.test(QuotationService.java:21) ~[classes/:na]
at welledmedia.backend.controllers.QuotationController.test(QuotationController.java:18) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:204) ~[spring-security-web-5.4.1.jar:5.4.1]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.4.1.jar:5.4.1]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at java.base/java.lang.Thread.run(Thread.java:835) ~[na:na]
2021-05-19 10:46:23.001 WARN 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : Finished building on-disk font cache, found 566 fonts
2021-05-19 10:46:23.188 WARN 29492 --- [nio-8082-exec-1] org.apache.pdfbox.pdmodel.PDDocument : You are overwriting an existing file, this will produce a corrupted file if you're also reading from it
删除 mstmc.ttf 文件对我有用,该文件不是字体。 PDFbox 正在尝试读取此文件,但由于它不是字体,因此无法读取文件,这就是导致错误的原因。
感谢@mkl 和@Tilman hausherr 帮助了我。
我正在尝试填写一张用 adobe acrobat 创建的 pdf 表单,该表单包含一个名为 'txt_name' 的文本字段。填写表格我使用的是 Apache PDFBox。
填写pdf表格的代码
try {
PDDocument pDDocument =
Loader.loadPDF(ResourceUtils.getFile("classpath:pdf/test.pdf"));
PDAcroForm pDAcroForm = pDDocument.getDocumentCatalog().getAcroForm();
pDAcroForm.getField("txt_name").setValue("test");
pDDocument.save("./src/main/resources/pdf/generated/test.pdf");
pDDocument.close();
} catch (IOException e) {
e.printStackTrace();
}
如您所见,我正在加载名为 'test.pdf' 的 pdf 文件。在此之后,我想用名称 'txt_name' 填写字段并将值设置为 'test',但是当我尝试填写该字段时,我得到一个 EOFException.我也收到错误 'Could not load font file: C:\WINDOWS\FONTS\mstmc.ttf'。我的计算机上没有此文件,但当我尝试在网上查找有关此文件的任何信息时,我没有得到任何好的结果。
PDFBox 版本:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>3.0.0-RC1</version>
</dependency>
我也尝试了不同的版本,但这行不通。
堆栈跟踪:
2021-05-19 10:46:22.549 WARN 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : New fonts found, font cache will be re-built
2021-05-19 10:46:22.550 WARN 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : Building on-disk font cache, this may take a while
2021-05-19 10:46:22.833 ERROR 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : Could not load font file: C:\WINDOWS\FONTS\mstmc.ttf
java.io.EOFException: null
at org.apache.fontbox.ttf.TTFDataStream.readUnsignedInt(TTFDataStream.java:150) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.fontbox.ttf.TTFParser.readTableDirectory(TTFParser.java:298) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:139) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:87) ~[fontbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFont(FileSystemFontProvider.java:630) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:374) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:350) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:135) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:154) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:418) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFontBoxFont(FontMapperImpl.java:381) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.FontMapperImpl.getFontBoxFont(FontMapperImpl.java:355) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:146) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.PDType1Font.<clinit>(PDType1Font.java:63) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processSetFont(PDDefaultAppearanceString.java:169) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processOperator(PDDefaultAppearanceString.java:132) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processAppearanceStringOperators(PDDefaultAppearanceString.java:109) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.<init>(PDDefaultAppearanceString.java:87) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaultAppearanceString(PDVariableText.java:93) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.<init>(AppearanceGeneratorHelper.java:115) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:261) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:210) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:218) ~[pdfbox-3.0.0-RC1.jar:3.0.0-RC1]
at welledmedia.backend.services.QuotationService.test(QuotationService.java:21) ~[classes/:na]
at welledmedia.backend.controllers.QuotationController.test(QuotationController.java:18) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.6.jar:5.3.6]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.6.jar:5.3.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.45.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:204) ~[spring-security-web-5.4.1.jar:5.4.1]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.4.1.jar:5.4.1]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.6.jar:5.3.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar:5.3.6]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.45.jar:9.0.45]
at java.base/java.lang.Thread.run(Thread.java:835) ~[na:na]
2021-05-19 10:46:23.001 WARN 29492 --- [nio-8082-exec-1] o.a.p.p.font.FileSystemFontProvider : Finished building on-disk font cache, found 566 fonts
2021-05-19 10:46:23.188 WARN 29492 --- [nio-8082-exec-1] org.apache.pdfbox.pdmodel.PDDocument : You are overwriting an existing file, this will produce a corrupted file if you're also reading from it
删除 mstmc.ttf 文件对我有用,该文件不是字体。 PDFbox 正在尝试读取此文件,但由于它不是字体,因此无法读取文件,这就是导致错误的原因。
感谢@mkl 和@Tilman hausherr 帮助了我。