Some additional remarks of the current (not working) situation:
XWiki is running on a machine with a FreeBSD operating system which does not support docker.
A different Debian machine runs a Docker instance ( zenika/apline-chrome) with the following start command:
docker run -d -p 9222:9222 zenika/alpine-chrome --no-sandbox
\ --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222
\ --disable-web-security --disable-gpu --remote-allow-origins=*
\ --headless=old --run-compistor-stages-before-draw
\ --disable-dev-shm-usage --window-size=1920,18000
The additional parameters are due to the fact that I have verified the functionality of the installation with a node test program.
–disable-gpu - without this, chrome will not run on this machine anyway
–disable-dev-shm-usage is due to the fact that without this parameter chrome crashes on certain web pages.
The two parameters are set
- –run-compistor-stages-before-draw
- –window-size=1920,18000
due the fact that some web pages load pictures after scroll to the position. To avoid scrolling within the program I use a very large window and all pictures are loaded from the beginning.
The value 18000 is a quick shot. May be there are web pages with a unlimited “papyrus like” design.
(–run-compistor-stages-before-draw was a trial and is still left.)
The test program uses Chrome DevTools Protocol commands natively and communicates using a web socket and initiates a “Page.printToPDF” when network traffic has finished (use of “Network.enable”)
summarized:
I have a running “chrome-print-to-pdf”-Server
The server can connect to XWiki (tested by generating PDF of the XWIki login page)
The server is recognized by XWiki when configurating PDF output.
But
PDF export starts and stops with an popup error message “Export als PDF fehlgeschlagen” (german XWiki)
The used account is a local XWiki account (user/password only)
The error message in catalina.out:
2024-06-18 11:15:17,880 [pool-19-thread-4] ERROR g.k.c.s.i.WebSocketServiceImpl - Failed sending data to ws server ws://134.147.111.6:9222/devtools/browser/e02885eb-6dc0-45b6-8f19-954ba728006f...
java.lang.IllegalStateException: The connection has been closed.
at org.glassfish.tyrus.core.TyrusSession.checkConnectionState(TyrusSession.java:530)
at org.glassfish.tyrus.core.TyrusSession.getBasicRemote(TyrusSession.java:212)
at com.github.kklisura.cdt.services.impl.WebSocketServiceImpl.send(WebSocketServiceImpl.java:128)
at com.github.kklisura.cdt.services.impl.ChromeDevToolsServiceImpl.invoke(ChromeDevToolsServiceImpl.java:142)
at com.github.kklisura.cdt.services.invocation.CommandInvocationHandler.invoke(CommandInvocationHandler.java:87)
at com.sun.proxy.$Proxy175.getVersion(Unknown Source)
at org.xwiki.export.pdf.internal.chrome.ChromeManager.lambda$isConnected$0(ChromeManager.java:129)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
It looks like the web-socket communication between XWiki and Chrome does not work (why?) although http-Request work (“/json/list”) is successful (when testing if the server is working)
Any ideas for further testing / investigations ?
Thanks
Norbert