Linux deployment kkFileView

  kkFlileView is a java open source file preview project. Before I do a feature on all types of office documents online preview, for me this was a white guy, very difficult indeed to do a preview, but the good news found in the online open source springboot kkFileView of this project, help me to solve this big problem. kkFileVie support doc, docx, ppt, pptx, xls, xlsx, zip, rar, mp4, mp3 and many like text such as txt, html, xml, java, properties, sql, js, md, json, conf, ini, vue, php, py, bat, gitignore and other documents online preview, very powerful, not only to meet my request, also provide functional features, it is really something to be praised!

Official online experience (you can look at the results)

Address: http://file.keking.cn/

 

Then talk about kkFileView deployed in the server above

First, download the compressed package

From the code cloud release download the latest version of the release package

Second, pre-installed on the server environment

(1) environmental requirements

  1. Java: 1.8+

  2. OpenOffice or LiberOffice (under Windows is built, it will automatically download and install on CentOS or Ubuntu, MacOS X need to install it yourself)

    (I am here is CentOS environment)

(2) Environment Configuration

The server is running the following code:

  yum install -y libXext.x86_64
  yum groupinstall -y "X Window System"

Third, the extracting archive

Extract the downloaded zip archive (locally decompression), which was put under the server directory, open the bin directory folder, run startup.sh script.

Run the statement

  sh startup.sh

Browser to access the server port 8012 ( " HTTP: // + " server public IP + ": 8012") to see the demonstration project with Home, 8012 port on the server if no note is open. If not, go to the security group to open?

(My "Navicat connect to the server database," describes how to finally have to face some security group to open the port you want)

Fourth, the use of project access

When you need to preview the files in your project, simply call the interface browser to open a preview of the project, and the incoming url need to preview the file, for example:

  var url = 'http://127.0.0.1:8080/file/test.txt'; // file access address to preview 
  window.open ( 'http://127.0.0.1:8012/onlinePreview?url='+ encodeURIComponent (previewUrl));

V. preview garbled

Font problems

On most Linux systems are not pre-installed Chinese fonts or incomplete, you need to copy the fonts used on a Linux server, as follows: The C under Windows: \ Windows \ Fonts directory full of files copied to the Linux / usr / share / fonts directory. Followed by the implementation of mkfontscale, mkfontdir, fc-cache the fonts into force (some fonts need to upload a separate batch upload tend to automatically be skipped)

(If you are prompted mkfontscale: command not found, you need to install their own # yum install mkfontscale)

(If you are prompted fc-cache: command not found, you will need to install # yum install fontconfig)

After installation is complete, restart the server

     reboot

(My "Linux Add Fonts" thing read a detailed process description)

Coding problems

生成html网页也是用的服务器操作系统默认编码(java系统属性:sun.jnu.encoding),比如用浏览器用手动更改编码格式为utf-8gbk打开没有问题,但是用浏览器默认编码就有问题,此时可调整系统配置文件中的配置项converted.file.charset可解决此类乱码问题

 

 

 

官方wiki文档:https://gitee.com/kekingcn/file-online-preview/wikis/pages?sort_id=1444366&doc_id=106093

官方介绍文档:https://gitee.com/kekingcn/file-online-preview/blob/master/README.md

Guess you like

Origin www.cnblogs.com/xiaomingwang/p/11567967.html