gpt4 book ai didi

javascript - 将 html 转换为 pdf

转载 作者:IT王子 更新时间:2023-10-29 01:24:55 24 4
gpt4 key购买 nike

我正在尝试从 linux 将 html 转换为 pdf,我还必须在网络应用程序中使用它,请让我知道有哪些工具可用于此。请让我知道任何其他工具

到目前为止我已经尝试过了

    html2ps htmlfilename > a.ps
ps2pdf a.ps > a.pdf

但是上面没有转换图片,忽略了css。我的开发环境是linux(RHEL5)

我也试过http://www.webupd8.org/2009/11/convert-html-to-pdf-linux.html我得到这个错误

  [root@localhost bin]# ./wkhtmltopdf www.example.com a.pdf
./wkhtmltopdf: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory

最佳答案

您走在正确的道路上:wkhtmltopdf是最简单的方法。请注意,存储库中的代码可能已过时(不确定此包的最新程度);您可能需要从源代码编译它,或获取静态链接版本(它很大,但已经包含 QT 库和其他依赖项)。

此外,在您的情况下,您可能只是缺少一个库 - 安装 libqt4-webkit-dev 可能会在这里起到作用。

关于javascript - 将 html 转换为 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6139538/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com