golang 在线预览word,excel,pdf,MarkDown(Online Preview Word,Excel,PPT,PDF,Image by Golang)

Go View File

 在线体验地址
 http://39.97.98.75:8082/view/upload
 (不会经常更新,保留最基本的预览功能。服务器配置较低,如果出现链接超时请等待几秒刷新重试,或者换Chrome)  

目前已经完成

docker部署 (不用为运行环境烦恼)

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
Similar Resources

Words - help with a word finder game, sketches a text-processing utility program

Shell-style text processing in Go I saw a word game where the puzzle gives you six letters. By means of a clever user interface, you construct words f

Jan 1, 2022

golang program that simpily converts html into markdown

Simpily converts html to markdown Just a simple project I wrote in golang to convert html to markdown, surprisingly works decent for a lot of websites

Oct 23, 2021

Enhanced Markdown template processor for golang

emd Enhanced Markdown template processor. See emd README file TOC Install glide

Jan 2, 2022

Golang library for converting Markdown to HTML. Good documentation is included.

md2html is a golang library for converting Markdown to HTML. Install go get github.com/wallblog/md2html Example package main import( "github.com/wa

Jan 11, 2022

Blackfriday: a markdown processor for Go

Blackfriday Blackfriday is a Markdown processor implemented in Go. It is paranoid about its input (so you can safely feed it user-supplied data), it i

Jan 8, 2023

⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Jan 6, 2023

Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

Dec 19, 2022

Upskirt markdown library bindings for Go

Goskirt Package goskirt provides Go-bindings for the excellent Sundown Markdown parser. (F/K/A Upskirt). To use goskirt, create a new Goskirt-value wi

Oct 23, 2022

A CLI markdown converter written in Go.

MDConv is a markdown converter written in Go. It is able to create PDF and HTML files from Markdown without using LaTeX. Instead MDConv u

Dec 20, 2022
Convert scanned image PDF file to text annotated PDF file
Convert scanned image PDF file to text annotated PDF file

Jisui (自炊) This tool is PoC (Proof of Concept). Jisui is a helper tool to create e-book. Ordinary the scanned book have not text information, so you c

Dec 11, 2022
Convert Microsoft Word Document to Markdown
Convert Microsoft Word Document to Markdown

docx2md Convert Microsoft Word Document to Markdown Usage $ docx2md NewDocument.docx Installation $ go get github.com/mattn/docx2md Supported Styles

Jan 4, 2023
Automation Tool to auto generate markdown notes from online classes/talks/presentations.
Automation Tool to auto generate markdown notes from online classes/talks/presentations.

autonotes Automation tool to autocapture screenshots and join them with a supplied .srt or .txt file and output a notes file in markdown. Problem? Wat

Aug 29, 2021
Online server tool to made markdown document.

An authenticated(basic auth with digest) docsify server for private markdown documents. Embedded docsify-mermaid as UML tool.

Oct 16, 2021
Markdown - Markdown converter for golang

markdown ?? Talks ?? Join ?? Youtube ❤️ Sponsor Install via nami nami install ma

Jun 2, 2022
🚩 TOC, zero configuration table of content generator for Markdown files, create table of contents from any Markdown file with ease.
🚩 TOC, zero configuration table of content generator for Markdown files, create table of contents from any Markdown file with ease.

toc toc TOC, table of content generator for Markdown files Table of Contents Table of Contents Usage Installation Packages Arch Linux Homebrew Docker

Dec 29, 2022
Mdfmt - A Markdown formatter that follow the CommonMark. Like gofmt, but for Markdown

Introduction A Markdown formatter that follow the CommonMark. Like gofmt, but fo

Dec 18, 2022
A PDF renderer for the goldmark markdown parser.
A PDF renderer for the goldmark markdown parser.

goldmark-pdf goldmark-pdf is a renderer for goldmark that allows rendering to PDF. Reference See https://pkg.go.dev/github.com/stephenafamo/goldmark-p

Jan 7, 2023
Convert your markdown files to PDF instantly
Convert your markdown files to PDF instantly

Will take a markdown file as input and then create a PDF file with the markdown formatting.

Nov 7, 2022
A targeted word list generation tool
A targeted word list generation tool

dirtywords Inspired by gau, dirtywords builds targeted wordlists for a given domain using "dirty" knowledge from AlienVault's Open Threat Exchange, th

Dec 3, 2022