I am trying to display a pdf file using the <image> tag. I followed the advice from
[Show pdf from filesystem outside project directory]
Unfortunately, this example does not work. Just in case, I’m providing the project for error reproduction.
showPdfIssue.zip (4.0 MB)
If I try to display a large pdf file, roughly more than 2Mb, an error occurs (show errors). If the file is smaller, it shows icon like that…
2023-10-17T20:31:35.672+06:00 ERROR 515952 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[springServlet] : Servlet.service() for servlet [springServlet] threw exception
java.io.IOException: Connection reset by peer
at java.base/sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:na]
at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:62) ~[na:na]
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) ~[na:na]
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) ~[na:na]
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) ~[na:na]
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:589) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:533) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:540) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:112) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:193) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.coyote.Response.doWrite(Response.java:613) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:334) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:780) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:683) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:382) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:360) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96) ~[tomcat-embed-core-10.1.8.jar:10.1.8]
...
Could someone provide a working example of displaying a pdf file?