2 Star 3 Fork 0

czc / GoViewFIle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Go View File

在线体验地址(不会经常更新,保留最基本的预览功能) : http://39.97.98.75:8082/view/upload

目前已经完成

Word、Excel、PPT转码为PDF

PDF转码为图片

对Word,Excel,PPT和PDF的图片式在线预览

本地上传预览

MarkDown文件预览

Excel转html

目录介绍 (本项目用的是GoFrame框架)

        .
        ├── app
        │   ├── api                        控制器
        │   ├── model                      结构体定义
        |   |—— service                    业务逻辑
        ├── cache
        │   ├── convert                    转图片后的文件 
        │   ├── download                   预览文件下载目录
        │   ├── local                      本地预览上传
        │   └── pdf                        转pdf后的文件
        ├── config
        │   └── config.toml                配置文件
        ├── library                        公共方法
        ├── log                            日志
        ├── main.go
        ├── public                         
        │   ├── html                       前端资源html,css,js
        │   └── index.html                 首页
        ├── router
        │   └── router.go                  路由
        ├── template                       模板
        │   └── index.html                 本地上传页面   

项目截图

部署编译

docker 部署

因为没有推送远程镜像,所以需要自己手动打包镜像
0 : 安装docker
1 :  git clone https://github.com/CZHIC/GoViewFIle.git
2 :  进入GoViewFIle 目录
3 : 打包镜像 docker build -t  goviewfile:v0.7 .
4 :  查看镜像 docker images
5 :  运行容器  docker run -d -p 8082:8082 goviewfile:v0.7

Windows版

准备

    1.安装Libreoffice,下载官方msi包,傻瓜式安装即可 (https://zh-cn.libreoffice.org)

    2.将Libreoffice安装路径下的program文件夹加入PATH中

    3.安装ImageMagick,官方包,傻瓜式安装即可,安装7.0以上版本 (https://ghostscript.com/download/gsdnld.html)

    4.安装GhostScript,官方包,傻瓜式安装即可 (https://ghostscript.com/download/gsdnld.html)

编译

     1.git clone https://github.com/CZHIC/GoViewFIle.git
     2.cd GoViewFIle
     3.go build
运行

     GoViewFile.exe

Linux版

准备

    1.安装Libreoffice:yum install  libreoffice

    2.安装ImageMagick:yum install imagemagick

    4.修改ImageMagick的配置,vi etc/ImageMagick-6/policy.xml

        修改
        <policy domain="coder" rights="none" pattern="PDF" />

        <policy domain="coder" rights="read|write" pattern="PDF" />
        下方新增一行
        <policy domain="coder" rights="read|write" pattern="LABEL" />

        wq退出保存

     5 如果出现报错
        yum install libreoffice-headless
        yum install libreoffice-writer
        export DISPLAY=:0.0

    5.安装字体(如果出现乱码)
        打包一台Windows机器的C:\Windows\Fonts下的所有文件
        发送到Linux机器上
        解压后进入Fonts文件夹,依次执行mkfontscale,mkfontdir,fc-cache


编译
    1.git clone https://github.com/CZHIC/GoViewFIle.git
    2.cd GoViewFIle
    3.go build

运行

    1. ./GoViewFIle

访问

    远程预览: http://127.0.0.1:8082//view/view?url=被预览文件的url
    本地上传: http://127.0.0.1:8082/view/upload
    首页 :    http://127.0.0.1:8082
MIT License Copyright (c) 2018 john@goframe.org https://goframe.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

golang 在线预览word,excel,pdf,MarkDown(Online Preview Word,Excel,PPT,PDF,Image by Golang) 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/czhic/GoViewFIle.git
git@gitee.com:czhic/GoViewFIle.git
czhic
GoViewFIle
GoViewFIle
main

搜索帮助