【问题标题】:Add multiple pages to new PDF using PIL/Pillow使用 PIL/Pillow 将多个页面添加到新 PDF
【发布时间】:2015-12-02 07:14:31
【问题描述】:

http://pillow.readthedocs.org/en/3.0.x/handbook/image-file-formats.html#pdf

Pillow 文档提到能够保存多个页面,但我找不到任何其他文档或代码示例告诉您如何将页面添加到新 PDF。

【问题讨论】:

    标签: python pdf pdf-generation python-imaging-library pillow


    【解决方案1】:

    您可以尝试以下方法:

    im.save('test.pdf', save_all=True)
    

    默认情况下,输出格式由文件扩展名决定。这在release notes 中有记录。

    【讨论】:

    【解决方案2】:

    目前 Pillow 似乎无法做到这一点,我使用 reportlab 从头开始​​构建多页 PDF:

    https://pypi.python.org/pypi/reportlab

    【讨论】:

      猜你喜欢
      • 2015-04-02
      • 2014-07-15
      • 1970-01-01
      • 1970-01-01
      • 2015-05-14
      • 1970-01-01
      • 2011-05-06
      • 1970-01-01
      • 2020-02-19
      相关资源
      最近更新 更多