复杂图标的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
相关推荐
qq_4221525720 小时前
PDF 转 Word 哪个工具好用?2026 年主流方案对比与选型指南
pdf·word
AI导出鸭PC端21 小时前
智谱清言怎么生成word文档?AI导出鸭终结乱码烦恼
人工智能·ai·c#·word·豆包·ai导出鸭
2601_961194021 天前
27考研资料|免费全套|电子版
考研·百度·微信·pdf·微信公众平台·facebook·新浪微博
asdzx671 天前
使用 Python 精准提取 Word 文档中的文本与表格
python·word
齐齐大魔王1 天前
Word缩放打印功能
word
开开心心就好1 天前
清理重复文件释放C盘空间的工具
安全·智能手机·pdf·gitlab·音视频·intellij idea·1024程序员节
2501_930707781 天前
使用C#代码在现有 PDF 文档中添加页眉
pdf
Metaphor6921 天前
使用 Python 旋转 PDF 页面
python·pdf
2601_961194021 天前
考研资料电子版|下载|pdf
java·python·考研·eclipse·django·pdf·pygame
hust_a1 天前
做了一个类似MinerU的pdf解析网站
pdf