pdf-nupper: n-up (combine) pages in PDF files
Posted by systemUp@reddit | Python | View on Reddit | 7 comments
What My Project Does
I've been using a Python script to n-up PDF files for some time when printing PDFs. N-upping means combining a few pages to a single page. For example, you can combine a PDF that has lecture slides as 2x2 so 4 slides will be printed in a single page. I pubilshed this in PyPI after some improvements in the hope someone else may find it useful as well. It uses pypdf to handle the grunt work.
Target Audience
Anybody who wants to n-up their PDFs before printing. This is useful to reduce the number of sheets printed, especially when you print slides or study material.
Comparison
When I first created the script I didn't see anything else that did exactly what I wanted to do the right amount of flexibility and simplicity.
- Project in PyPI: https://pypi.org/project/pdf-nupper/
- Source in Github: https://github.com/thameera/pdf-nupper
Any feedback or contributions would be welcome!
Esetrucho@reddit
I was just looking for something like this! I just tried it and it works as expected. It would be interesting to be able to combine slides while leaving empty columns for notes. lets say I want a 2x2 format, one column for slides and one column for notes.
systemUp@reddit (OP)
Great to hear it worked for you! That would be an interesting improvement and possibly not too difficult to implement.
proggob@reddit
I was all ready to tell you to just use pypdf :)
I’ve thought of making something to combine a set of notes into one A4 page in such a way that it can be folded up into a little book. I was going to use it as backup notes when traveling but I guess the need for it feels like it’s passed.
systemUp@reddit (OP)
Yeah, pypdf is basically what we need, although this script hides some calculations etc that goes into scaling and positioning without having to think about them.
Your idea for generating a foldable booklet is neat - it should be possible to get done with pypdf indeed.
SmallSheepDog@reddit
Congrats! What library do you use to handle pdf? Does it work with image based pdf?
systemUp@reddit (OP)
This uses pypdf which I found very easy to use. The code that handles the actual logic is here: https://github.com/thameera/pdf-nupper/blob/main/pdf_nupper/core.py
Ok-master7370@reddit
I've thought of something like this, I'll definitely use it