测试代码变动
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.optima.document.test.bean;
|
||||
|
||||
import com.deepoove.poi.data.Pictures;
|
||||
import com.optima.document.api.DocumentService;
|
||||
import com.optima.document.test.config.DocumentServiceConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -10,6 +11,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -42,6 +44,9 @@ public class DocumentConverter {
|
||||
departmentList.add("处置部门2");
|
||||
params.put("departmentList", departmentList);
|
||||
|
||||
byte[] bytes = Files.readAllBytes(Paths.get("/Users/yanghuanglin/Downloads/02.png"));
|
||||
params.put("img", Pictures.ofBytes(bytes).size(48, 27).create());
|
||||
|
||||
// 生成word,并转为pdf
|
||||
byte[] generatedWord = documentService.generateWord(Files.readAllBytes(sourceFile.toPath()), params);
|
||||
byte[] wordedToPdf = documentService.wordToPdf(generatedWord, true);
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Configuration
|
||||
@@ -23,6 +22,7 @@ public class DocumentServiceConfig {
|
||||
public DocumentService documentService() {
|
||||
// 创建客户端代理
|
||||
HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();
|
||||
|
||||
String serviceUrl;
|
||||
if (server.endsWith("/")) {
|
||||
serviceUrl = server + "document-service";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
document:
|
||||
server: http://127.0.0.1:9004
|
||||
source-file: /Users/yanghuanglin/Downloads/test.docx
|
||||
target-file: /Users/yanghuanglin/Downloads/test.pdf
|
||||
source-file: "/Volumes/Working/Works/Git Sources/document/document-test/src/main/resources/test.docx"
|
||||
target-file: "/Users/yanghuanglin/Downloads/test.pdf"
|
||||
|
||||
BIN
document-test/src/main/resources/test.docx
Normal file
BIN
document-test/src/main/resources/test.docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user