使用PIL / Pillow将多个页面添加到新PDF

时间:2015-12-02 07:14:32

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

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

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

2 个答案:

答案 0 :(得分:0)

您可以尝试以下方法:

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

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

中有记录

答案 1 :(得分:0)

Pillow目前似乎不可能这样,我使用reportlab从头开始构建多页PDF:

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