复杂图标的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 分钟前
DeepSeek长回答怎么保存成Word?避免逐段复制和漏内容
c#·word
weixin_4692738111 小时前
如何在线把文字转为 pdf 文档
pdf
2601_9639067812 小时前
离线截图 OCR 识别:支持表格与 PDF 解析
pdf·ocr·软件需求
asdzx6720 小时前
Python 实现 PDF 文本查找与高亮标注
开发语言·python·pdf
laoban-yu20 小时前
Word与PDF文档互转
pdf·word·文档转换
古少侠1 天前
用 DS随心转 把 AI 给的表格整理成排版正常、能改的 Word
word
2601_962295331 天前
Python自动化批量文档生成工具:Word与Excel的结合应用
python·自动化·word·excel·文档生成
鲲穹AI种草2 天前
PDF 文档多格式转换处理,多款 PDF 处理工具能力客观记录
pdf·文档格式转换
Felicia-侧听3 天前
PDF怎么转换成OFD?在线PDF转OFD方法
pdf·pdf转换·ofd·电子发票·文件格式转换·pdf转ofd·ofd格式
古少侠3 天前
用 DS随心转 把 AI 画的 Mermaid 流程图转成 Word 里的高清图
开发语言·c#·word