This commit is contained in:
linfso 2024-07-28 17:16:53 +08:00
parent e789d20abd
commit ef54839698
5 changed files with 23 additions and 10 deletions

View File

@ -271,9 +271,9 @@
<orderEntry type="library" name="Maven: xml-apis:xml-apis-ext:1.3.04" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-codec:1.14" level="project" />
<orderEntry type="module-library">
<library name="Maven: com.aspose:aspose-words:15.8.0">
<library name="Maven: com.aspose:aspose-words:19.1.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/../emis-biz/lib/aspose-words-15.8.0-jdk16.jar!/" />
<root url="jar://$MODULE_DIR$/../emis-biz/lib/aspose-words-19.1-jdk16.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -230,9 +230,9 @@
<orderEntry type="library" name="Maven: xml-apis:xml-apis-ext:1.3.04" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-codec:1.14" level="project" />
<orderEntry type="module-library">
<library name="Maven: com.aspose:aspose-words:15.8.0">
<library name="Maven: com.aspose:aspose-words:19.1.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/aspose-words-15.8.0-jdk16.jar!/" />
<root url="jar://$MODULE_DIR$/lib/aspose-words-19.1-jdk16.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

Binary file not shown.

View File

@ -151,15 +151,26 @@
<version>1.10.6</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.aspose</groupId>-->
<!-- <artifactId>aspose-words</artifactId>-->
<!-- <version>15.8.0</version>-->
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar</systemPath>-->
<!-- </dependency>-->
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<version>19.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
<systemPath>${project.basedir}/lib/aspose-words-19.1-jdk16.jar</systemPath>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.fastreport</groupId>-->
<!-- <artifactId>fastreport</artifactId>-->

View File

@ -57,16 +57,18 @@ public class DocUtils {
* @throws Exception
*/
public static void wordToPdf(InputStream wordInput, OutputStream pdfOutput) throws Exception {
getLicense();
// getLicense();
//通过aspose-words.jar中的类转换文件
Document wordDoc = new Document(wordInput);
FontSubstitutionWarningCollector callback = new FontSubstitutionWarningCollector();
wordDoc.setWarningCallback(callback);
if(!StringUtils.isEmpty(SystemConfig.FONT_PATH)) {
FontSettings.setFontsFolder(SystemConfig.FONT_PATH, false);
// FontSettings.setFontsFolder(SystemConfig.FONT_PATH, false);
FontSettings.getDefaultInstance().setFontsFolder(SystemConfig.FONT_PATH, false);
}
PdfSaveOptions pso = new PdfSaveOptions();
wordDoc.save(pdfOutput, pso);
// PdfSaveOptions pso = new PdfSaveOptions();
// wordDoc.save(pdfOutput, pso);
wordDoc.save(pdfOutput, SaveFormat.PDF);
}
@SneakyThrows