sipp11
10 years ago
2 changed files with 37 additions and 1 deletions
@ -0,0 +1,35 @@
|
||||
--- |
||||
layout: post |
||||
title: "Save x page per sheet PDF in python" |
||||
author: |
||||
display_name: sipp11 |
||||
login: sipp11 |
||||
email: sipp11@gmail.com |
||||
url: '' |
||||
author_login: sipp11 |
||||
author_email: sipp11@gmail.com |
||||
date: Aug 2, 2015 |
||||
categories: |
||||
- coding |
||||
tags: |
||||
- python |
||||
- pdf |
||||
--- |
||||
|
||||
|
||||
Reportlab is my go-to PDF library in `python`; however, it doesn't do multiple page layout well. The solution is to do regular multiple pages PDF with `reportlab`, then process that PDF file afterward to have any layout you want (2-page per sheet, 4-page per sheet, 9-page per sheet, ...) |
||||
|
||||
What you need? |
||||
|
||||
`pdfnup` -- it's available via `pip` but an ImportError always there. As a result, you need to download [that](https://bitbucket.org/deeplook/pdfnup/overview) and do install by yourself. |
||||
|
||||
$ python setup.py install |
||||
|
||||
Simple enough. You also have a command line to work on too. |
||||
|
||||
>>> from pdfnup import generateNup |
||||
>>> |
||||
>>> generateNup("multiple-pages.pdf", 2, verbose=True) |
||||
written: file-2up.pdf |
||||
|
||||
There you go. |
Loading…
Reference in new issue