复杂图标的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
相关推荐
慧都小妮子14 小时前
Aspose.CAD for .NET 26.6 更新发布
pdf·.net·3d渲染·cad·pdf导出·ifc编辑
蝉蜕日记16 小时前
AccumuPDF高级版 v2.57 | 视图文转换PDF,合并分割压缩
android·智能手机·pdf·生活·软件需求
蓝创工坊Blue Foundry18 小时前
PDF 批量提取指定内容到 Excel:按字段整理多个 PDF 的方法
pdf·ocr·excel·文心一言·paddlepaddle·paddle
Am-Chestnuts20 小时前
AI长回答批量导出PDF与长图:多轮内容整理和免费Markdown备份
人工智能·pdf·aigc
zyplayer-doc21 小时前
研发接口文档怎么长期维护:zyplayer-doc把API、Markdown和变更记录放进同一个知识库
大数据·数据库·人工智能·笔记·pdf·ocr
蜡台1 天前
uniapp pdf文件预览组件
pdf·uni-app·合同·pdfh5
Am-Chestnuts2 天前
【无标题】
pdf
王莎莎-MinerU2 天前
MCP 解决的是工具接入,科研 Agent 还缺的是科学证据接口标准化
开发语言·网络·人工智能·深度学习·pdf·c#·php
qq_466302452 天前
如何在word中添加代码
word
一棵星2 天前
LibreOffice Word 转 PDF 报错 “source file could not be loaded” 完整解决方案
pdf·word