Magicodes.IE.Pdf 使用提示 SSL异常问题
Magicodes.IE.Pdf 使用提示 SSL异常问题
项目中有使用Magicodes.IE.Pdf.导出html为pdf,可是最近在使用包含图片的地址的时候,类似于
<img src="https://img.com/test.png">的时候,提示
2022-01-11T11:13:15.715588077Z QSslSocket: cannot call unresolved function SSLv23_client_method
2022-01-11T11:13:15.715628852Z QSslSocket: cannot call unresolved function SSL_library_init
2022-01-11T11:13:15.717159408Z QSslSocket: cannot call unresolved function SSLv23_client_method
2022-01-11T11:13:15.717183959Z QSslSocket: cannot call unresolved function SSL_library_init
2022-01-11T11:13:15.717386418Z QSslSocket: cannot call unresolved function SSLv23_client_method
2022-01-11T11:13:15.717429277Z QSslSocket: cannot call unresolved function SSL_library_init
在本地windows机器上不存在这个问题,咨询群主中尝试过把图片地址换为http也没问题 都能正常导出显示
查阅后得知
- Pdf导出底层基于wkhtmltopdf库的封装,已包含wkhtmltopdf各平台的包,无需再次安装
- 下载源码之后里面有使用到
Haukcode.DinkToPdfTuesPechkinTuesPechkin.Wkhtmltox.AnyCPU - TuesPechkin
It is built and tested around wkhtmltopdf 0.12.2基于0.12.2查看详情 TuesPechkin.Wkhtmltox.AnyCPUIt is built and tested around wkhtmltopdf 0.12.4.则是基于0.12.4 查看详情- 最新版本为0.12.6 wkhtmltopdf
还提供了对abp moudle支持 赞
项目部署方式使用的是docker容器化部署,镜像基础为debian 里面的libssl 默认版本为1.1
cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
方案一 [推荐]
如果想要正常使用的话,需要 wkhtmltopdf 为0.15.3以上的版本有修复这个问题 [推荐]
方案二 [不推荐]
如果不升级wkhtmltopdf版本的话,可以降级libssl为1.0版本【不推荐】
apt-get install libssl1.0-dev
这个时候会提示在源中无法找到1.0的版本,系统已经安装了最新的1.1版本。这个时候进入到容器内部
- docker exec -it [containerid/name] /bin/bash
- cd etc/apt
- 备份sources.list
mv /etc/apt/sources.list /etc/apt/sources.list.bak - 我直接找了一份清华大学的debian源 debian | 清华大学开源软件镜像站 |
- copy进容器内部替换原来的sources.list
- 更新 apt update
- apt-get install libssl1.0-dev
- 可以查看当前版本
ldconfig -p |grep libssl - 我这样一通操作之后还是不行 #¥%#%……&%¥,最后重启了容器 即可正常导出 图片正常显示
参考
debian | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
三里清风三里路

浙公网安备 33010602011771号