提交 25f6e70a 作者: 刘凯歌

合并分支 'event_fusion_dev' 到 'event_fusion'

转pdf字体bug修改

查看合并请求 !18
...@@ -130,16 +130,19 @@ public class DocUtil { ...@@ -130,16 +130,19 @@ public class DocUtil {
* @author lkg * @author lkg
* @date 2025/9/16 * @date 2025/9/16
*/ */
public static void convertWordTo(InputStream wordInputStream, OutputStream outputStream,int saveFormat) throws Exception { public static void convertWordToPdf(InputStream wordInputStream, OutputStream outputStream) throws Exception {
getLicense(); getLicense();
PdfSaveOptions saveOptions = new PdfSaveOptions();
if (SystemUtils.IS_OS_LINUX) { if (SystemUtils.IS_OS_LINUX) {
FontSettings fontSettings = new FontSettings(); FontSettings fontSettings = new FontSettings();
//true 表示递归查询子文件夹 //true 表示递归查询子文件夹
fontSettings.setFontsFolder(fontsPath, true); fontSettings.setFontsFolder(fontsPath, true);
// 确保Aspose在渲染PDF时使用我们指定的字体文件夹
saveOptions.setFontEmbeddingMode(PdfFontEmbeddingMode.EMBED_ALL);
} }
// 从输入流加载Word文档 // 从输入流加载Word文档
Document doc = new Document(wordInputStream); Document doc = new Document(wordInputStream);
// 将文档保存到输出流(PDF) // 将文档保存到输出流(PDF)
doc.save(outputStream, saveFormat); doc.save(outputStream, saveOptions);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论