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.

Thu Oct 13, 2022 3:41 pm

I've been following the direction in the "Java-convert-HTML-to-PDF" tutorial for "Spire.PDF for Java" to create a Java controller to handle converting an HTML string to a PDF. Everything is working great in windows. However, when I deploy it to linux and use the linux plugins, it is not working. The PDF file is simply not being created. The code is not generating any errors, and debugging shows the HTML string and the plugin path are correct. I've also tried using HttpServletResponse.getOutputStream(), which again works in windows and displays the PDF to the browser, but in linux it renders a blank PDF page with a 0 content-length.

HtmlConverter.convert(htmlString, response.getOutputStream(), true, 100000, new Size(700, 900), new PdfMargins(0), LoadHtmlType.Source_Code);

The controller class in being packaged in a WAR file and deployed to WebSphere Application Server (8.5.5.20) running on linux. Any help would be greatly appreciated. Thanks!

ecaudill
 
Posts: 2
Joined: Wed Oct 12, 2022 8:47 pm

Fri Oct 14, 2022 10:57 am

Hello,

Thanks for your inquiry
Now, the result document is erratic when using the QT plugin version 5.4.12(qt-5.14.2-plugins-linux-x64.tar.gz) in linux system. Please check the version of QT plugin you are using on linux system. If you are using QT plugin version 5.4.12, please update to QT plugin version 5.9.8. If the issue still exists after updating, please offer the following message to help us do further investigation. Thanks for your assistance in advance.

1) Your full test code including html string that can reproduce your issue.
2) The Jdk version, such as Oracle Jdk1.8.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Oct 14, 2022 4:01 pm

Thanks for the response. Where can I get the latest plugins? I'm currently using the ones linked to on this page:
/Tutorials/Java/Spire.PDF-for-Java/Program-Guide/Conversion/Java-convert-HTML-to-PDF.html
which is:
/downloads/plugins/java/plugins-linux-x64.zip

It's a .zip file instead of .tar.gz, so I'm wondering if I'm using outdated plugins. Thanks!

ecaudill
 
Posts: 2
Joined: Wed Oct 12, 2022 8:47 pm

Mon Oct 17, 2022 10:57 am

Hello,

Thanks for your feedback.
The QT plugin for linux we uploaded to the website is in zip format, so there is no problem. In addition, please try testing other html string on linux to see if this issue still exists. If the issue still exists, please offer the following messages. Thanks for your assistance in advance.

1) Your full test code including html string that can reproduce your issue.
2) The Jdk version, such as Oracle Jdk1.8.
3) Your test environment, such as OS info (CentOS Linux release7.9.2009(Core)).

In addition, please note that this conversion method requires GUI (graphical user interface) support. For servers that do not have a graphical user interface installed, follow the following steps to convert.
Code: Select all
•Install Xvfb
Centos:yum install Xvfb
Ubuntu:apt-get install Xvfb
•Use xvfb-run to run the jar file
xvfb-run java -jar HTMLToPDF.jar


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF