推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
tonghuashuai
V2EX  ›  Python

Python office 文件转 pdf 有没有什么好的方案啊

  •  
  •   tonghuashuai ·
    tonghs · May 26, 2015 · 5325 views
    This topic created in 4077 days ago, the information mentioned may be changed or developed.
    环境是:Linux + Python 2.7

    需要将 office 文件转 pdf ,然后 pdf 再用七牛的接口转成图片。
    七牛倒是可以将 office 转 pdf ,http://developer.qiniu.com/docs/v6/api/reference/fop/odconv.html
    但是转的 pdf 不可以再转图片了,现在能想到的是:
    office 文件上传到七牛,转 pdf 下载下来,再传一次 pdf ,然后再转成图片。
    但感觉这样做太纠结了,有没有什么好的方法呢?
    5 replies    2015-05-26 12:37:28 +08:00
    quix
        1
    quix  
       May 26, 2015
    libreoffice , python 有不少库封装的
    lerry
        2
    lerry  
       May 26, 2015
    同libreoffice,seafile用的应该就是这个
    jason52
        3
    jason52  
       May 26, 2015
    靠楼主你问对人了~俺现在这个回答给你节省不少时间~你先镇定一下!!!

    pdf转图片不用走七牛!!!还网上走一遍多费劲。。用imagemagic~~

    ===
    convert -density 300 -antialias Doc1.pdf doc1.png
    ===

    请叫我雷锋同志(逃
    jason52
        4
    jason52  
       May 26, 2015
    还有你前半个问题~既然是office,为啥又是linux环境涅~

    liboffice转会有一些问题嘚~

    win下有com接口哒~批处理应该行,不过这部分楼主就是一点也不知道我在说啥了(大雾)~
    geeklian
        5
    geeklian  
       May 26, 2015
    最佳转换质量的方法就是装个windows,Python + pywin32,win32com
    调word,打开文件,另存pdf。

    linux下搞,有时候字体会变得很细很难看,有时候填充文本的颜色会变,反正就是失真很多...
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2914 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 01:19 · PVG 09:19 · LAX 18:19 · JFK 21:19
    ♥ Do have faith in what you're doing.