JustView(Office、CAD、三维模型)在线预览平台调用说明

简介

justview在线预览平台由自主开发,支持office、图片、pdf、cad、等常用文件在线预览

今天,我们新增了三维模型的预览功能,市面上基本上所有三维设计软件输出的格式都支持!!!

三维预览示例:

部件:

组件:

1.word预览

 2.excel预览(支持复杂excel,100%完美还原)

 3.ppt预览

 4.pdf预览

5.图片预览

 6.CAD预览(内容已涂改)

接口调用说明

1.上传本地文件预览

接口地址:http://ip:端口/jushview/onlinePreview/fileview

请求方式:post,get

调用代码示例:

public static String postParams(String url, String filepath, String type) {
	CloseableHttpClient httpclient =HttpClients.createDefault();
	CloseableHttpResponse response = null;
	String result = null;
	try {
		HttpPost httpPost = new HttpPost(url);
		MultipartEntityBuilder mEntityBuilder =
		MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
		mEntityBuilder.setCharset(Charset.forName("UTF-8"));
		FileBody file = new FileBody(new File(filepath));
		//添加文件
		mEntityBuilder.addPart("file", file);
		//添加普通参数
		StringBody comment = new StringBody(type,ContentType.APPLICATION_JSON);
		mEntityBuilder.addPart("convertType", comment);
		HttpEntity reqEntity =mEntityBuilder.build();
		httpPost.setEntity(reqEntity);
		response = httpclient.execute(httpPost);
		int statusCode =response.getStatusLine().getStatusCode();
		if (statusCode == HttpStatus.SC_OK) {
			HttpEntity resEntity = response.getEntity();
			byte [] josn = EntityUtils.toByteArray(resEntity);
			result = new String(josn,"UTF-8");
			EntityUtils.consume(resEntity);
		}
	}
	catch (Exception e) {
		e.printStackTrace();
	} finally {
		HttpClientUtils.closeQuietly(httpclient);
		HttpClientUtils.closeQuietly(response);
	}
	return result;
}

2.传递文件地址预览

接口地址:http://ip:端口/jushview/onlinePreview/urlview

请求方式:post,get

示例:

http://127.0.0.1:8080/jushview/onlinePreview/urlview?file=SbybbsswesaydqwSDqweqsdniwqeqweasdmoiqwhybcnkmcnue

参数名

参数类型

必填

参数释义及示例

file

String

文件的直接下载地址url,采用Base64加密

统一结果返回

参数名

参数类型

必填

参数释义及示例

success

boolean

true:正常返回结果,无报错,可预览

false:不可预览

msg

String

若存在报错,则会返回报错内容

viewurl

String

预览的地址,直接打开及可预览

示例:

{

“success”:true,

”msg”:””,

”viewurl”:”http://127.0.0.1:8080/jushview/”

}

通用参数

参数示例:

参数名

参数类型

必填

参数释义及示例

cache

Boolean

是否缓存,默认true

watermark

String

水印内容,需要水印则不会缓存

format

String

转为哪种格式预览

QQ:451417966

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值