在实际项目开发过程,项目使用数据存在多种形式,“文件”也是一种常见形式,因此,“文件预览”功能变成了常规需求。
kkFileView项目使用流行的spring boot搭建,易上手和部署。万能的文件预览开源项目,基本支持主流文档格式预览,如:

1、kkFileView下载地址
https://gitee.com/kekingcn/file-online-preview
2、启动kkFileView之前,需要安装Apache_OpenOffice_4.0.1_Win_x86_install_zh-CN.728932882
3、启动项目
启动路径:E:\kkFileView\file-online-preview-master\server\src\main\bin
点击:startup.exe文件
4、html调用预览接口
<!DOCTYPE html>
 <html>
     <head>
         <meta charset="utf-8">
         <title></title>        
         <script type="text/javascript" src="base64.min.js"></script>
     </head>
     
     <script>
          var b64Encoded = Base64.encode("http://localhost:1222/file/岳阳市社会经济及土地利用现状.pdf");
          window.open('http://127.0.0.1:8886/onlinePreview?url=' + encodeURIComponent(b64Encoded));
         
     </script>
     <body>
         
     </body>
 </html>
