复杂图标的word转pdf

1、word转pdf

引用pom

xml 复制代码
   <!-- Source: https://mvnrepository.com/artifact/cn.wisewe/docx4j-wisewe-convert -->
        <dependency>
            <groupId>cn.wisewe</groupId>
            <artifactId>docx4j-wisewe-convert</artifactId>
            <version>1.7.1.RELEASE</version>
            <scope>compile</scope>
        </dependency>

2、java代码

java 复制代码
   // 使用 DocumentConverter 将 Word 转换为 PDF
            DocumentConverter.create()
                    .input(new FileInputStream(docxFilePath))
                    .output(new FileOutputStream(pdfFilePath))
                    .convert(DocumentConvertType.PDF);

3、 服务器上没有中文字体报错

在线方案; 直接安装就行了

离线解决:

java 复制代码
# 2. 将项目中的字体文件上传到服务器
# 从项目中 fonts/ 目录上传 simhei.ttf 和 simsun.ttc 到服务器
# 可以使用 scp 命令:
# scp fonts/simhei.ttf user@server:/usr/share/fonts/chinese/
# scp fonts/simsun.ttc user@server:/usr/share/fonts/chinese/

本机查找中文:

java 复制代码
C:\Windows\Fonts\

挑选几个中文字体上传到服务器上

docker 启动 需要挂载字体目录

java 复制代码
docker run -v /usr/share/fonts/:/usr/share/fonts/  image
相关推荐
泡海椒4 小时前
Java 生成接口调用量趋势 PDF:jquick-pdf 多重折线图(JChartType.MultipleLine)落地
java·开发语言·pdf
泡海椒2 天前
quick-pdf 饼图(JChartType.PIE)实战:五个客户层级五块扇区的配色与标签
pdf
泡海椒5 天前
Java 生成资金流向图 PDF:jquick-pdf 树图(JTreeChartData)节点尺寸与间距的追问记录
java·python·pdf
开开心心就好5 天前
电脑禁止自动休眠工具,还能按负载定时
算法·智能手机·pdf·电脑·word·音视频·lua
前端fighter6 天前
2026年前端面试题总结(pdf版)
前端·pdf
AI英德西牛仔10 天前
PC 用户的效率革命:腾讯元宝导出 Word 指令与“AI 导出鸭”的底层逻辑
人工智能·word·excel·deepseek·ai导出鸭
科研邪修法11 天前
PDF新增页面文字与文本批注怎么区分?以双版本培训讲义为例
前端·css·pdf
ComPDFKit11 天前
RAG 回答只显示 PDF 文件名?用 Python 保留引用页码
开发语言·python·pdf·rag
科研邪修法11 天前
固定列宽PDF表格改字:文本边界、单位字段与修改前后复核
pdf