金山文檔在線預覽編輯服務
共 4978字,需瀏覽 10分鐘
·
2020-11-26 01:57
商品參數(shù)
交付方式
人工交付
交付時長
10天
商品介紹
商品亮點
- 文件格式轉(zhuǎn)換:金山WPS在線預覽可同時供多個業(yè)務系統(tǒng)進行對接和集成,協(xié)助業(yè)務系統(tǒng)實現(xiàn)對office、pdf和圖片等30多種格式文檔的在線預覽。
- 文件無損預覽:WPS PC客戶端打開這個文檔什么樣,用瀏覽器做在線預覽的時候就是什么樣子。支持版式文檔:PDF、OFD、圖片、Visio、…
- 文檔智能處理:具備豐富的后臺對接接口,能轉(zhuǎn)成PDF、書簽接口、水印接口、安全能力。
商品規(guī)格說明:
并發(fā)文檔30,30M最大單文檔上限? ?價格: 2800元/年
并發(fā)文檔50,50M最大單文檔上限? ?價格: 9000元/年
商品說明
| 版本:?V1.0 | 交付方式:?License |
| 適用于:?Android/Linux/iOS | 上架日期:?2020-11-10 |
目前,支持doc(x)/xls(x)/ppt(x)/pdf等多種常用格式轉(zhuǎn)為H5形式進行預覽,實現(xiàn)快速查看文檔內(nèi)容,預覽過程不依賴于本地Office。在PC預覽的基礎上,轉(zhuǎn)換出的H5頁面也可以很好的兼容移動端,在移動設備上經(jīng)過特別優(yōu)化,支持適應屏幕大小,實現(xiàn)高保真預覽效果。
金山WPS在線預覽是由一組后臺服務組成,并提供接口供業(yè)務系統(tǒng)進行對接。需要客戶單位提供獨立的(虛擬或物理)服務器進行部署,并按照如下說明實現(xiàn)相關(guān)接口。
支持格式
文件預覽支持格式
演示 pptx,?ppt,?pot,?potx,?pps,?ppsx,?dps,?dpt,?pptm,?potm,?ppsm
表格 xls,?xlt,?et,?ett,?xlsx,?xltx,?csv,?xlsb,?xlsm,?xltm
文字 doc,?dot,?wps,?wpt,?docx,?dotx,?docm,?dotm
安全文檔 wpss,?dpss,?ets
便攜文檔 pdf
開發(fā) lrc,?c,?cpp,?h,?asm,?s,?java,?asp,?bat,?bas,?prg,?cmd
其他 rtf,?txt,?log,?xml,?htm,?html
圖片 jpeg,?jpg,?png,?gif,?bmp,?tif
壓縮文件 Zip,?7z,?rar?(暫時不支持加密壓縮包)
模塊組成
圖1?模塊組成關(guān)系圖
集成預覽服務組成:預覽組件、WPS組件、業(yè)務端對接模塊。
預覽組件(XView):預覽服務的組成部分,負責接收前端用戶預覽請求。
WPS組件(Yun-wps):預覽服務的組成部分,負責將業(yè)務系統(tǒng)提供的文檔轉(zhuǎn)換成對應的預覽文件體。
對接模塊:整個預覽流程的關(guān)鍵環(huán)節(jié),由業(yè)務系統(tǒng)負責實現(xiàn)相應接口,比如:v1/3rd/fileinfo等接口。
預覽流程
預覽流程
圖2?預覽轉(zhuǎn)換流程圖
場景開發(fā)實例
實時預覽場景
適用于業(yè)務系統(tǒng)(比如:OA),文檔通過WPS?Office起草完成后,流轉(zhuǎn)過程中需要領(lǐng)導在移動端審批或瀏覽文檔內(nèi)容時使用。
文檔信息接口
業(yè)務系統(tǒng)服務端需要實現(xiàn)/v1/3rd/fileinfo接口,詳細請參考?業(yè)務實現(xiàn)接口
fileinfo示例如下:?示例下載
package?demo;
import?java.io.*;
import?org.springframework.http.*;
import?org.springframework.web.bind.annotation.*;
import?org.apache.commons.codec.digest.DigestUtils;
@RestController
public?class?FileInfoController?{
????@RequestMapping("/v1/3rd/fileinfo")
????public?FileInfo?getFileInfo(@RequestParam?String?fileName)?{
????????FileInfo?result?=?new?FileInfo();
????????result.setFname(fileName);
????????result.setUrl("C:\\files\\"?+?fileName);
????????try?{
????????????result.setUniqueId(DigestUtils.sha1Hex(new?FileInputStream(result.getUrl())));
????????}?catch?(IOException?ex)?{
????????????throw?new?InvalidFileException(fileName);
????????}
????????result.setGetFileWay(GetFileWay.LocalFile);
????????result.setEnableCopy(true);
????????result.setWatermarkType(WatermarkType.Text);
????????result.setWatermark("Kingsoft?WPS");
????????System.out.println(result);
????????return?result;
????}
????@ExceptionHandler(InvalidFileException.class)
????@ResponseStatus(HttpStatus.NOT_FOUND)
????public?GetFileInfoError?procErr3rdInvalidFileException(InvalidFileException?e)?{
????????return?new?GetFileInfoError(ErrorCode.InvalidFile,?"",?e.getFileName()?+?"?文件不存在");
????}
}
前端請求預覽
業(yè)務系統(tǒng)前端需要調(diào)用http://預覽服務地址/v1/view?任意參數(shù)
任意參數(shù):業(yè)務系統(tǒng)能識別的文件信息
HTML請求示例如下:
:/v1/view/preview?fileName=1.doc">1.doc?
文檔預轉(zhuǎn)場景
適用于業(yè)務系統(tǒng)(比如:檔案管理系統(tǒng)),通常業(yè)務部門有大量的文檔需要查閱時,為了節(jié)省預覽轉(zhuǎn)換的時間,可以提前對文檔進行預轉(zhuǎn)緩存,需要使用時可快速查看文檔內(nèi)容。
文檔信息接口
業(yè)務系統(tǒng)服務端需要實現(xiàn)/v1/3rd/fileinfo接口,詳細請參考?基礎運行環(huán)境
fileinfo示例如下:?示例下載
package?demo;
import?java.io.*;
import?org.springframework.http.*;
import?org.springframework.web.bind.annotation.*;
import?org.apache.commons.codec.digest.DigestUtils;
@RestController
public?class?FileInfoController?{
????@RequestMapping("/v1/3rd/fileinfo")
????public?FileInfo?getFileInfo(@RequestParam?String?fileName)?{
????????FileInfo?result?=?new?FileInfo();
????????result.setFname(fileName);
????????result.setUrl("C:\\files\\"?+?fileName);
????????try?{
????????????result.setUniqueId(DigestUtils.sha1Hex(new?FileInputStream(result.getUrl())));
????????}?catch?(IOException?ex)?{
????????????throw?new?InvalidFileException(fileName);
????????}
????????result.setGetFileWay(GetFileWay.LocalFile);
????????result.setEnableCopy(true);
????????result.setWatermarkType(WatermarkType.Text);
????????result.setWatermark("Kingsoft?WPS");
????????System.out.println(result);
????????return?result;
????}
????@ExceptionHandler(InvalidFileException.class)
????@ResponseStatus(HttpStatus.NOT_FOUND)
????public?GetFileInfoError?procErr3rdInvalidFileException(InvalidFileException?e)?{
????????return?new?GetFileInfoError(ErrorCode.InvalidFile,?"",?e.getFileName()?+?"?文件不存在");
????}
}
JAVA請求示例如下:
package?demo;
import?java.io.*;
import?org.springframework.web.bind.annotation.*;
import?org.apache.http.*;
import?org.apache.http.client.*;
import?org.apache.http.client.methods.*;
import?org.apache.http.impl.client.*;
import?com.fasterxml.jackson.databind.*;
@RestController
public?class?ConversionController?{
????@RequestMapping("/conversion")
????public?ConversionResult?conversion(@RequestParam?String?fileName)?throws?Exception?{
????????ConversionResult?result?=?null;
????????CloseableHttpClient?httpclient?=?HttpClients.createDefault();
????????try?{
????????????//?請求在線預覽服務的接口/v1/view,傳入要預覽的文件名(這里文件名作文件唯一編號)
????????????HttpGet?httpGet?=?new?HttpGet("http://192.168.40.139:8237/v1/view?fileName="?+?fileName);
????????????System.out.println("Executing?request?"?+?httpGet.getRequestLine());
????????????//?處理在線預覽服務的響應信息
????????????ResponseHandler?resp?new?ResponseHandler()?{
????????????????@Override
????????????????public?ConversionResult?handleResponse(final?HttpResponse?response)?throws?ClientProtocolException,?IOException?{
????????????????????int?status?=?response.getStatusLine().getStatusCode();
????????????????????if?(status?>=?200?&&?status?300)?{
????????????????????????ObjectMapper?mapper?=?new?ObjectMapper();
????????????????????????//?將響應的Json數(shù)據(jù),轉(zhuǎn)換成實體類
????????????????????????return?mapper.readValue(response.ge
金山WPS在線預覽是由一組后臺服務組成,并提供接口供業(yè)務系統(tǒng)進行對接。需要客戶單位提供獨立的(虛擬或物理)服務器進行部署,并按照如下說明實現(xiàn)相關(guān)接口。
支持格式
文件預覽支持格式
演示 pptx,?ppt,?pot,?potx,?pps,?ppsx,?dps,?dpt,?pptm,?potm,?ppsm
表格 xls,?xlt,?et,?ett,?xlsx,?xltx,?csv,?xlsb,?xlsm,?xltm
文字 doc,?dot,?wps,?wpt,?docx,?dotx,?docm,?dotm
安全文檔 wpss,?dpss,?ets
便攜文檔 pdf
開發(fā) lrc,?c,?cpp,?h,?asm,?s,?java,?asp,?bat,?bas,?prg,?cmd
其他 rtf,?txt,?log,?xml,?htm,?html
圖片 jpeg,?jpg,?png,?gif,?bmp,?tif
壓縮文件 Zip,?7z,?rar?(暫時不支持加密壓縮包)
模塊組成
圖1?模塊組成關(guān)系圖
集成預覽服務組成:預覽組件、WPS組件、業(yè)務端對接模塊。
預覽組件(XView):預覽服務的組成部分,負責接收前端用戶預覽請求。
WPS組件(Yun-wps):預覽服務的組成部分,負責將業(yè)務系統(tǒng)提供的文檔轉(zhuǎn)換成對應的預覽文件體。
對接模塊:整個預覽流程的關(guān)鍵環(huán)節(jié),由業(yè)務系統(tǒng)負責實現(xiàn)相應接口,比如:v1/3rd/fileinfo等接口。
預覽流程
預覽流程
圖2?預覽轉(zhuǎn)換流程圖
場景開發(fā)實例
實時預覽場景
適用于業(yè)務系統(tǒng)(比如:OA),文檔通過WPS?Office起草完成后,流轉(zhuǎn)過程中需要領(lǐng)導在移動端審批或瀏覽文檔內(nèi)容時使用。
文檔信息接口
業(yè)務系統(tǒng)服務端需要實現(xiàn)/v1/3rd/fileinfo接口,詳細請參考?業(yè)務實現(xiàn)接口
fileinfo示例如下:?示例下載
package?demo;
import?java.io.*;
import?org.springframework.http.*;
import?org.springframework.web.bind.annotation.*;
import?org.apache.commons.codec.digest.DigestUtils;
@RestController
public?class?FileInfoController?{
????@RequestMapping("/v1/3rd/fileinfo")
????public?FileInfo?getFileInfo(@RequestParam?String?fileName)?{
????????FileInfo?result?=?new?FileInfo();
????????result.setFname(fileName);
????????result.setUrl("C:\\files\\"?+?fileName);
????????try?{
????????????result.setUniqueId(DigestUtils.sha1Hex(new?FileInputStream(result.getUrl())));
????????}?catch?(IOException?ex)?{
????????????throw?new?InvalidFileException(fileName);
????????}
????????result.setGetFileWay(GetFileWay.LocalFile);
????????result.setEnableCopy(true);
????????result.setWatermarkType(WatermarkType.Text);
????????result.setWatermark("Kingsoft?WPS");
????????System.out.println(result);
????????return?result;
????}
????@ExceptionHandler(InvalidFileException.class)
????@ResponseStatus(HttpStatus.NOT_FOUND)
????public?GetFileInfoError?procErr3rdInvalidFileException(InvalidFileException?e)?{
????????return?new?GetFileInfoError(ErrorCode.InvalidFile,?"",?e.getFileName()?+?"?文件不存在");
????}
}
前端請求預覽
業(yè)務系統(tǒng)前端需要調(diào)用http://預覽服務地址/v1/view?任意參數(shù)
任意參數(shù):業(yè)務系統(tǒng)能識別的文件信息
HTML請求示例如下:
:/v1/view/preview?fileName=1.doc">1.doc?
文檔預轉(zhuǎn)場景
適用于業(yè)務系統(tǒng)(比如:檔案管理系統(tǒng)),通常業(yè)務部門有大量的文檔需要查閱時,為了節(jié)省預覽轉(zhuǎn)換的時間,可以提前對文檔進行預轉(zhuǎn)緩存,需要使用時可快速查看文檔內(nèi)容。
文檔信息接口
業(yè)務系統(tǒng)服務端需要實現(xiàn)/v1/3rd/fileinfo接口,詳細請參考?基礎運行環(huán)境
fileinfo示例如下:?示例下載
package?demo;
import?java.io.*;
import?org.springframework.http.*;
import?org.springframework.web.bind.annotation.*;
import?org.apache.commons.codec.digest.DigestUtils;
@RestController
public?class?FileInfoController?{
????@RequestMapping("/v1/3rd/fileinfo")
????public?FileInfo?getFileInfo(@RequestParam?String?fileName)?{
????????FileInfo?result?=?new?FileInfo();
????????result.setFname(fileName);
????????result.setUrl("C:\\files\\"?+?fileName);
????????try?{
????????????result.setUniqueId(DigestUtils.sha1Hex(new?FileInputStream(result.getUrl())));
????????}?catch?(IOException?ex)?{
????????????throw?new?InvalidFileException(fileName);
????????}
????????result.setGetFileWay(GetFileWay.LocalFile);
????????result.setEnableCopy(true);
????????result.setWatermarkType(WatermarkType.Text);
????????result.setWatermark("Kingsoft?WPS");
????????System.out.println(result);
????????return?result;
????}
????@ExceptionHandler(InvalidFileException.class)
????@ResponseStatus(HttpStatus.NOT_FOUND)
????public?GetFileInfoError?procErr3rdInvalidFileException(InvalidFileException?e)?{
????????return?new?GetFileInfoError(ErrorCode.InvalidFile,?"",?e.getFileName()?+?"?文件不存在");
????}
}
JAVA請求示例如下:
package?demo;
import?java.io.*;
import?org.springframework.web.bind.annotation.*;
import?org.apache.http.*;
import?org.apache.http.client.*;
import?org.apache.http.client.methods.*;
import?org.apache.http.impl.client.*;
import?com.fasterxml.jackson.databind.*;
@RestController
public?class?ConversionController?{
????@RequestMapping("/conversion")
????public?ConversionResult?conversion(@RequestParam?String?fileName)?throws?Exception?{
????????ConversionResult?result?=?null;
????????CloseableHttpClient?httpclient?=?HttpClients.createDefault();
????????try?{
????????????//?請求在線預覽服務的接口/v1/view,傳入要預覽的文件名(這里文件名作文件唯一編號)
????????????HttpGet?httpGet?=?new?HttpGet("http://192.168.40.139:8237/v1/view?fileName="?+?fileName);
????????????System.out.println("Executing?request?"?+?httpGet.getRequestLine());
????????????//?處理在線預覽服務的響應信息
????????????ResponseHandler?resp?new?ResponseHandler()?{
????????????????@Override
????????????????public?ConversionResult?handleResponse(final?HttpResponse?response)?throws?ClientProtocolException,?IOException?{
????????????????????int?status?=?response.getStatusLine().getStatusCode();
????????????????????if?(status?>=?200?&&?status?300)?{
????????????????????????ObjectMapper?mapper?=?new?ObjectMapper();
????????????????????????//?將響應的Json數(shù)據(jù),轉(zhuǎn)換成實體類
????????????????????????return?mapper.readValue(response.ge
評論
圖片
表情
