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 Aug 06, 2024 1:50 am

如附件所示,Linux似乎丢失了html的样式,代码如下:
Code: Select all
        //指定插件路径
        String pluginPath = FileConstants.SPIRE_PDF_PLUGINS_PATH;
        //设置插件路径
        HtmlConverter.setPluginPath(pluginPath);
        //将HTML字符串转换为PDF
        HtmlConverter.convert(htmlString,
                outputFile,
                true,
                5 * 60 * 1000,
                size,
                new PdfMargins(0),
                LoadHtmlType.Source_Code);

启动命令:xvfb-run java -jar xxxx.jar

zhj132171
 
Posts: 8
Joined: Fri Aug 02, 2024 11:33 pm

Tue Aug 06, 2024 9:33 am

你好,

感谢留言。
下面这个插件版本是5.14.2的,在样式上比之前的插件版本有所优化,您可以下载解压之后,传到linux环境中替换之前的plugins试一下。如果还有问题,欢迎随时反馈。

https://www.e-iceblue.com/plugins/qt-5. ... x64.tar.gz

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 409
Joined: Mon Nov 07, 2022 8:10 am

Wed Aug 07, 2024 2:26 am

你好,

感谢,但是这个下载地址404了

zhj132171
 
Posts: 8
Joined: Fri Aug 02, 2024 11:33 pm

Wed Aug 07, 2024 2:36 am

您好,

抱歉,请使用下面的地址下载。
https://www.e-iceblue.com/downloads/plu ... x64.tar.gz

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 409
Joined: Mon Nov 07, 2022 8:10 am

Wed Aug 07, 2024 7:08 am

您好,

使用新的地址下载的插件之后,出现了代码似乎没有执行,也没有异常抛出就结束了的问题:
代码:
Code: Select all
    public static void htmlStringToPdf(String htmlString, String outputFile, Size size) {
        //指定插件路径
        String pluginPath = FileConstants.SPIRE_PDF_PLUGINS_PATH;
        //设置插件路径
        HtmlConverter.setPluginPath(pluginPath);
        //将HTML字符串转换为PDF
        HtmlConverter.convert(htmlString,
                outputFile,
                true,
                5 * 60 * 1000,
                size,
                new PdfMargins(0),
                LoadHtmlType.Source_Code);
    }

我已经下载了插件、给予了文件夹775权限并在代码中加载。
maven中spire.pdf版本:
Code: Select all
        <dependency>
            <groupId>e-iceblue</groupId>
            <artifactId>spire.pdf</artifactId>
            <version>10.7.3</version>
        </dependency>

系统类型为:centos8 (alibaba cloud linux 3)
启动命令为:xvfb-run java -jar xxx.jar

zhj132171
 
Posts: 8
Joined: Fri Aug 02, 2024 11:33 pm

Wed Aug 07, 2024 9:45 am

你好,

请问您使用新的插件时用echo命令提示的报错是您在另一个帖子下面附的这个吗?

Code: Select all
echo "<p>test text</p>" |xvfb-run ./Html2Pdf "placeholder" "test.pdf" 800 600 0 0 0 0 1
[3561333:3561333:0807/112205.341323:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.


Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 409
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.PDF