md
This commit is contained in:
parent
96fe57dad8
commit
e998ad2a33
@ -106,13 +106,13 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>com.mascloud</groupId>-->
|
<groupId>com.mascloud</groupId>
|
||||||
<!-- <artifactId>massdk</artifactId>-->
|
<artifactId>massdk</artifactId>
|
||||||
<!-- <version>1.0.3</version>-->
|
<version>1.0.3</version>
|
||||||
<!-- <scope>system</scope>-->
|
<scope>system</scope>
|
||||||
<!-- <systemPath>${project.basedir}/lib/masmgc.sdk.sms-1.0.3-SNAPSHOT.jar</systemPath>-->
|
<systemPath>${project.basedir}/lib/masmgc.sdk.sms-1.0.3-SNAPSHOT.jar</systemPath>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.xdadan.erp.emis.service.warehouse;
|
package com.xdadan.erp.emis.service.warehouse;
|
||||||
|
|
||||||
//import com.aspose.words.*;
|
import com.aspose.words.*;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
import com.deepoove.poi.config.Configure;
|
import com.deepoove.poi.config.Configure;
|
||||||
import com.deepoove.poi.data.PictureType;
|
import com.deepoove.poi.data.PictureType;
|
||||||
@ -12,9 +12,6 @@ import com.xdadan.erp.common.utils.StringUtils;
|
|||||||
import com.xdadan.erp.emis.domain.vo.Cargo;
|
import com.xdadan.erp.emis.domain.vo.Cargo;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@ -25,17 +22,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
|
||||||
public class DocUtils {
|
public class DocUtils {
|
||||||
|
|
||||||
// 字体目录
|
|
||||||
public static String FONT_PATH="";
|
|
||||||
|
|
||||||
@Value("${system.fontPath}")
|
|
||||||
public void setFontPath(String fontPath) {
|
|
||||||
DocUtils.FONT_PATH = fontPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填充数据
|
* 填充数据
|
||||||
* @param input 输入word文件数据流
|
* @param input 输入word文件数据流
|
||||||
@ -53,13 +41,13 @@ public class DocUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查看缺少的字体
|
// 查看缺少的字体
|
||||||
// private static class FontSubstitutionWarningCollector implements IWarningCallback {
|
private static class FontSubstitutionWarningCollector implements IWarningCallback {
|
||||||
// public void warning(WarningInfo info) {
|
public void warning(WarningInfo info) {
|
||||||
// if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
|
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
|
||||||
// log.error("==>font miss==>{}", info.getDescription());
|
log.error("==>font miss==>{}", info.getDescription());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* word转换为pdf
|
* word转换为pdf
|
||||||
@ -68,24 +56,24 @@ public class DocUtils {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void wordToPdf(InputStream wordInput, OutputStream pdfOutput) throws Exception {
|
public static void wordToPdf(InputStream wordInput, OutputStream pdfOutput) throws Exception {
|
||||||
// getLicense();
|
getLicense();
|
||||||
// //通过aspose-words.jar中的类转换文件
|
//通过aspose-words.jar中的类转换文件
|
||||||
// Document wordDoc = new Document(wordInput);
|
Document wordDoc = new Document(wordInput);
|
||||||
// FontSubstitutionWarningCollector callback = new FontSubstitutionWarningCollector();
|
FontSubstitutionWarningCollector callback = new FontSubstitutionWarningCollector();
|
||||||
// wordDoc.setWarningCallback(callback);
|
wordDoc.setWarningCallback(callback);
|
||||||
// if(!StringUtils.isEmpty(DocUtils.FONT_PATH)) {
|
if(!StringUtils.isEmpty(Config.FONT_PATH)) {
|
||||||
// FontSettings.setFontsFolder(DocUtils.FONT_PATH, false);
|
FontSettings.setFontsFolder(DocUtils.FONT_PATH, false);
|
||||||
// }
|
}
|
||||||
// PdfSaveOptions pso = new PdfSaveOptions();
|
PdfSaveOptions pso = new PdfSaveOptions();
|
||||||
// wordDoc.save(pdfOutput, pso);
|
wordDoc.save(pdfOutput, pso);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private static void getLicense() {
|
private static void getLicense() {
|
||||||
// try (InputStream is = DocUtils.class.getClassLoader().getResourceAsStream("License.xml")) {
|
try (InputStream is = DocUtils.class.getClassLoader().getResourceAsStream("License.xml")) {
|
||||||
// License license = new License();
|
License license = new License();
|
||||||
// license.setLicense(is);
|
license.setLicense(is);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void genPdfByDocxTpl(InputStream tplStream,Map fillDataMap,OutputStream os) throws Exception {
|
public static void genPdfByDocxTpl(InputStream tplStream,Map fillDataMap,OutputStream os) throws Exception {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user