复杂图标的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
相关推荐
AI导出鸭PC端4 天前
Perplexity批量导出没有PDF模式?AI导出鸭插件补上最后一块拼图
人工智能·pdf·c#·ai导出鸭
Ravenq~4 天前
无头转换:把 .docx 变成 PDF,不打开编辑器
pdf·编辑器
联犀5 天前
纯 Go 的 CAD 开源库 go-cad:直接解析 DWG/DXF,现在也能导出 PDF
开发语言·golang·pdf
IHaveADiscovery5 天前
无痛让AI由Markdown转Word:Pandoc模板了解一下
人工智能·word·markdown
FinelyYang8 天前
uniapp使用kkfileview在线预览ppt,excel,word,pdf类型文件
pdf·uni-app·powerpoint
yivifu8 天前
使用lxml操作 Word 的 OpenXML 底层
word·openxml·lxml
WORLDPO92268 天前
QTE-020-01-L/F/C-D-A-K-TR_实物_数据手册PDF_国产替代
pdf
asdzx679 天前
C# 操作 PDF 元数据:从属性写入到字段提取的完整流程
前端·pdf·c#
WORLDPO92269 天前
SFSDT-10/15/20/25/35-28-G-19.69-SR_实物图_数据手册PDF_国产替代
pdf·pcb工艺·pcb
梦想出海-Phoebe9 天前
Gemini新增文件编辑功能:PDF、Word、Excel处理体验分享
pdf·word·excel