Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add booklet command #77

Merged
merged 4 commits into from
Dec 7, 2024
Merged

Add booklet command #77

merged 4 commits into from
Dec 7, 2024

Conversation

pastor-robert
Copy link
Contributor

Add command "booklet". It reorders and 2-ups the pages to create a booklet. Booklets have a page count that is a multiple of four. If the input file's page count is not a multiple, blank pages, or user-specified pages, are inserted in fixed locations.

@Lucas-C
Copy link
Member

Lucas-C commented Dec 2, 2024

Thank you very much for your contribution @pastor-robert 👍

We were already working on a x2pdf --format option that may overlap with your new subcommand: #63

A PR is in progress: #65
Could you maybe have a look at it? Wouldn't it cover a similar usage?

@pastor-robert
Copy link
Contributor Author

pastor-robert commented Dec 2, 2024

We were already working on a x2pdf --format option that may overlap with your new subcommand: #63

Thanks! I was very eager to get started, so I did not start a discussion or survey existing work. Mea culpa.

However, I don't see the overlap between these two. #63 is about specifying the output paper size of the x2pdf command. #77 produces an output file which, when printed and folded appropriately, creates a booklet. Notably, this feature does not include any resizing.

This PR reorders pages into "signature order" or "book order". Assuming an 8-page input.pdf, the following command sequences are equivalent.

pdfly booklet input.pdf output.pdf
pdfly cat -o tmp.pdf input.pdf 7 0 1 6 5 2 3 4 
pdfly 2-up -tmp.pdf output.pdf

If you are seeing an overlap that I'm missing, can you help me understand what that is?

@Lucas-C
Copy link
Member

Lucas-C commented Dec 2, 2024

If you are seeing an overlap that I'm missing, can you help me understand what that is?

You are right, there is no overlap with this feature 😅
I mixed things up, I wanted to refer to issue #64 & PR #67

So the question is: we could have x2pdf --layout 2x2 $imgs_or_pdfs to produce the ordering required to make a booklet,
but would a dedicated booklet subcommand be better for this?

Also, it seems that the booklet subcommand would extract pages from a single existing PDF, which would make it different from x2pdf behaviour...

The more I think about it, the more I'm starting to think that a dedicated booklet subcommand makes sense.

What do you think about it @pastor-robert? 🙂

@pastor-robert
Copy link
Contributor Author

Thanks @Lucas-C . I went through about the same logic that you did. After I posted that note, I found #64 / #67. I thought about commands like x2pdf --layout book-order input.pdf or 2-up --book-order input.pdf, but neither seemed to fit.

My intuition is that end-users would be more confused by adding book-order printing to either of those features than they would be by having the feature stand alone.

My recommendation is to make booklet stand apart from either x2pdf or 2-up.

Also, it seems that the booklet subcommand would extract pages from a single existing PDF, which would make it different from x2pdf behaviour...

I thought about having booklet subcommand take a set of PDF files & page ranges a la cat. I think that may be a good idea, but not for this initial version.

@Lucas-C Lucas-C merged commit 703df33 into py-pdf:main Dec 7, 2024
7 checks passed
@Lucas-C
Copy link
Member

Lucas-C commented Dec 7, 2024

Alright, you convinced me @pastor-robert 🙂

Merged!

Thank you very much for this excellent addition 👍

MartinThoma added a commit that referenced this pull request Dec 8, 2024
## What's new

### New Features (ENH)
- New `booklet` command to adjust offsets and lengths ([PR #77](#77))
- New `uncompress` command ([PR #75](#75))
- New `update-offsets` command to adjust offsets and lengths ([PR #15](#15))
- New `rm` command ([PR #59](#59))
- `metadata`: now also displaying CreationDate, Creator, Keywords & Subject ([PR #73](#73))
- Add warning for out-of-bounds page range in pdfly `cat` command ([PR #58](#58))

### Bug Fixes (BUG)
- `2-up` command, that only showed one page per sheet, on the left side, with blank space on the right ([PR #78](#78))

[Full Changelog](0.3.3...0.4.0)
@Lucas-C
Copy link
Member

Lucas-C commented Dec 8, 2024

This has been released in version 0.4.0: https://pypi.org/project/pdfly/#history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants