项目作者: canghailan

项目描述 :
Document Convert
高级语言: Python
项目地址: git://github.com/canghailan/doconv.git
创建时间: 2018-03-04T08:32:14Z
项目社区:https://github.com/canghailan/doconv

开源协议:

下载


文档格式转换服务

字体

字体安装

  1. mkdir -p /usr/share/fonts/truetype /usr/share/fonts/opentype
  2. apt-get -y install fontconfig
  3. fc-cache -fv

字体参考资料

免费中文字体

LibreOffice

官方仓库中版本过低,下载安装最新版本

  1. apt-get install -y openjdk-8-jre-headless libglu1-mesa libxinerama1 libdbus-glib-1-2 libcairo2 libsm6
  2. curl -OL 'http://download.documentfoundation.org/libreoffice/stable/6.0.2/deb/x86_64/LibreOffice_6.0.2_Linux_x86-64_deb.tar.gz'
  3. dpkg -i LibreOffice*/DEBS/*.deb

unoconv

官方仓库中版本过低,下载安装最新版本

  1. curl -OL 'https://raw.githubusercontent.com/dagwieers/unoconv/0.8.2/unoconv'

ImageMagick

Pandoc

官方仓库中版本过低,下载安装最新版本

  1. curl -OL 'https://github.com/jgm/pandoc/releases/download/2.1.2/pandoc-2.1.2-1-amd64.deb'

TexLive

TODO

  1. DEBIAN_FRONTEND=noninteractive
  2. apt-get install -yq texlive

Apache httpd

启用静态文件、CGI

Supervisor

  • Apache
  • unoconv

使用方法

  1. POST http://localhost/cgi-bin/worker.cgi
  2. Content-Type: text/plain;charset=utf-8
  3. mkdir -p /workspace/1/ \
  4. && cd /workspace/1/ \
  5. && curl -o a.ppt -O http://localhost/1.pptx \
  6. && unoconv -f pdf a.ppt \
  7. && convert a.pdf a.jpg

TODO

  • 字体配置待优化
  • 镜像大小待优化
  • CGI脚本待优化,目前未考虑安全及易用性问题
  • 文档待完善

附录:阿里云Docker镜像

  1. sudo apt-get update
  2. sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
  3. curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  4. sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  5. sudo apt-get -y update
  6. sudo apt-get -y install docker-ce
  7. sudo mkdir -p /etc/docker
  8. sudo tee /etc/docker/daemon.json <<-'EOF'
  9. {
  10. "registry-mirrors": [""]
  11. }
  12. EOF
  13. sudo systemctl daemon-reload
  14. sudo systemctl restart docker