admin管理员组文章数量:1604657
简介
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
版权声明:本文标题:JustView(Office、CAD、三维模型)在线预览平台调用说明 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1728463334a1159199.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论