Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Oct 14, 2025 7:04 pm

When testing out Spire PDF Java in Windows locally for HTML to PDF conversion, it's working as expected. However, when trying to run it in Linux EKS, we're getting a 200 OK with empty response.

After going through the forum, we tried running a few debug commands.

echo "<p>test text</p>" | xvfb-run ./Html2Pdf "" "output.pdf" 800 600 0 0 0 0
/usr/bin/xvfb-run: line 181: 5004 Segmentation fault (core dumped) DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
/usr/bin/xvfb-run: line 186: kill: (5001) - No such process

Has a similar issue been observed.

Can you also share a dockerfile with the list of dependencies please.

Following is a snippet of our dockerfile.

ENV XDG_RUNTIME_DIR="/opt/workdir/temp"

RUN microdnf install -y dnf yum-utils && \

dnf config-manager --add-repo mirror.stream.centos.org/9-stream/AppStream/x86_64/os/ && \

dnf install mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/xorg-x11-server-Xvfb-1.20.11-31.el9.x86_64.rpm -y --nogpgcheck && \
dnf install libglvnd-egl -y --nogpgcheck && \
dnf remove yum-utils -y && \
curl --request GET --insecure -o ./file.zip 'e-iceblue.com/downloads/plugins/java/plugins-linux-x64.zip' && \
unzip -q ./file.zip && rm ./file.zip && chmod -R 777 ./plugins_linux && mkdir -p /home/default && chmod -R 777 /home/default && \
mkdir -p /home/default/.pki/nssdb && chmod -R 777 /home/default/.pki/nssdb && chmod -R 777 /opt/workdir

USER 1001
RUN mkdir -p /opt/workdir/temp
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar

ENTRYPOINT xvfb-run java -XX:${JVM_GC} -Xms${MIN_JVM_MEMORY} -Xmx${MAX_JVM_MEMORY} -jar app.jar

pskraju88
 
Posts: 4
Joined: Mon Oct 13, 2025 6:31 pm

Wed Oct 15, 2025 9:58 am

Hello,

Thank you for your inquiry.
Could you please provide us with the details of your Linux system environment (e.g., ubuntu:20.04)? Please note that the HTML-to-PDF conversion relies on Qt plugins, and the operation of these plugins is dependent on the system's underlying GCC libraries. You could check whether your system environment meets the Qt plugin requirements by referring to the supported system versions for the Qt plugin on our official website via the link below:
https://doc.qt.io/archives/qt-5.9/supported-platforms.html
Additionally, we now offer a new method for converting HTML to PDF using Chrome.exe, which has lower system requirements. You may refer to the following link to try this approach:
https://www.e-iceblue.com/Tutorials/NET/Spire.PDF-for-.NET/Program-Guide/Conversion/C-Convert-HTML-to-PDF-using-ChromeHtmlConverter.html
Java code:
Code: Select all
        String inputUrl = "https://www.e-iceblue.com/Tutorials/JAVA/Spire.PDF-for-JAVA/Program-Guide/Spire.PDF-Program-Guide-Content-for-JAVA.html";
        String outputFile = "test.pdf";
        String chromeLocation = "chrome.exe";
        ChromeHtmlConverter converter = new ChromeHtmlConverter(chromeLocation);
        ConvertOptions options = new ConvertOptions();
        options.setTimeout(10 * 3000);
        converter.convertToPdf(inputUrl, outputFile, options);

If the issue persists, please provide us with your input files. This information will help us investigate your issue more accurately and offer an effective solution. You may upload the files as attachments or send them directly to my email: [email protected].
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Wed Oct 15, 2025 8:58 pm

Thanks for the reply.

The linux version being used is the following.

NAME="Red Hat Enterprise Linux"
VERSION="9.6 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.6"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.6 (Plow)"


Following is the code snippet we're trying to run locally on windows based on the example provided for ChromeHtmlConverter.

We're first testing out with the free version.


String inputUrl = "e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/C-/VB.NET-Convert-Image-to-PDF.html";
String outputFile = "test.pdf";

String chromeLocation = "C:\\Program Files\\Google\\Chrome\\Application\\new_chrome.exe";

ChromeHtmlConverter htmlConverter = new ChromeHtmlConverter(chromeLocation);

ConvertOptions options = new ConvertOptions();

htmlConverter.convertToPdf(inputUrl, outputFile, options);

Following is the error being encountered.

stack_trace":"java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke \"com.spire.pdf.chromehtmlconverter.services.IWebSocketService.addMessageHandler(com.spire.pdf.chromehtmlconverter.services.IMessageHandler)\" because \"this.spr†\" is null\r\n\tat com.spire.pdf.packages.sprrkp.<init>(Unknown Source)\r\n\tat com.spire.pdf.chromehtmlconverter.ChromeHtmlConverter.convertToPdf(Unknown Source)\r\n\tat com.spire.pdf.chromehtmlconverter.ChromeHtmlConverter.convertToPdf(Unknown Source)


<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.pdf</artifactId>
<version>11.9.6</version>
</dependency>

pskraju88
 
Posts: 4
Joined: Mon Oct 13, 2025 6:31 pm

Thu Oct 16, 2025 5:32 am

Hello,

Thank you for your sharing.
The version of your system environment exceeds the supported range for the Qt plugin, which is causing the conversion failure. Regarding the Chrome-based conversion method, I have attached a complete test project for your reference. Please test in your environment. We look forward to your feedback.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Thu Oct 16, 2025 9:23 pm

Thank you for the working example. It's working locally.

1 : Inorder to run it on Linux, do we need to pass the location of chrome executable file as an argument to ChromeHtmlConverter("location");

2 : try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
ChromeHtmlConverter converter = new ChromeHtmlConverter();
URI uri = new URI(converter.getUrl());
IWebSocketService webSocketService = (IWebSocketService) WebSocketServiceImpl.create(uri);
converter.setWebSocketService(webSocketService);
ConvertOptions options = new ConvertOptions();

converter.convertToPdf(htmlString, outputStream, null);
}

In the above code snippet, do we need to create an instance of ChromeHtmlConverter , URI , IWebSocketService for every request? Is the method converter.convertToPdf() threadsafe?

3 : Is the use of ChromeHtmlConverter for Java documented anywhere?

pskraju88
 
Posts: 4
Joined: Mon Oct 13, 2025 6:31 pm

Fri Oct 17, 2025 9:21 am

Hello,

Thank you for your feedback. We're glad to hear that it's working.

Please find the answers to your questions below:

1. Yes, you need to specify the path to the Chrome executable file in the Linux environment as a parameter to the ChromeHtmlConverter("location") method.
2. Yes, you need to create a new instance of ChromeHtmlConverter, URI, and IWebSocketService for each request.
3. The Java help documentation for this solution has not been released yet. We apologize for the inconvenience and will publish it as soon as possible.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Wed Oct 22, 2025 9:53 pm

Web socket connection closed CLOSED_ABNORMALLY, Closed abnormally.
fail to delete: C:\Users\SAPOTT~1\AppData\Local\Temp\spire-user-data-dir3042436513603800\lockfile

Are the above messages a concern?

pskraju88
 
Posts: 4
Joined: Mon Oct 13, 2025 6:31 pm

Thu Oct 23, 2025 3:09 am

Hello,

Thank you for your inquiry.
If your conversion is working as expected, there's no need for concern. However, if you encounter any issues that affect the product's functionality, please use the following code to capture detailed logs. Kindly forward the relevant files to us, and we will conduct a thorough analysis.

Code: Select all
Logger logger=new Logger("test");
converter.setLogger(logger);
converter.getLogger().isEnabled(true);
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Return to Spire.PDF