|
|
@@ -44,8 +44,14 @@ public class Word2Pdf {
|
|
|
Document doc = new Document(inputStream);// 原始excel路径
|
|
|
|
|
|
FontSettings font = new FontSettings();
|
|
|
- font.setFontsFolder(File.separator + "usr" + File.separator + "share" + File.separator + "fonts", true);
|
|
|
- font.setDefaultFontName("KaiTi");
|
|
|
+ String path = "/usr/share/fonts";
|
|
|
+ FolderFontSource folderFontSource = new FolderFontSource(path, true);
|
|
|
+ ArrayList fontSources = (ArrayList) Arrays.asList(font.getFontsSources());
|
|
|
+ fontSources.add(folderFontSource);
|
|
|
+ FontSourceBase[] updatedFontSources = (FontSourceBase[]) fontSources.toArray(new FontSourceBase [fontSources.size()]);
|
|
|
+// font.setFontsFolder(path, true);
|
|
|
+// font.setDefaultFontName("KaiTi");
|
|
|
+ font.setFontsSources(updatedFontSources);
|
|
|
doc.setFontSettings(font);
|
|
|
|
|
|
/*PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(SaveFormat.PDF);
|