hellerbarde / stapler

A small utility making use of the pypdf library to provide a (somewhat) lighter alternative to pdftk
Other
284 stars 53 forks source link

Allow "backwards zipping" #11

Open fwenzel opened 9 years ago

fwenzel commented 9 years ago

Use case: If you have a "simplex" scanner, you can scan all the front pages (pages 1, 3, 5, 7, 9) and then turn over the stack and scan all the back pages, backwards (pages 10, 8, 6, 4, 2).

zip doesn't have to go crazy there, maybe it just needs to allow a page syntax such as -1- which would mean, start at page minus 1 and keep going (backwards) until the end.

hellerbarde commented 9 years ago

that's a cool idea. What do you propose to do with the case where there is an uneven number of pages?

fwenzel commented 9 years ago

I think that'd just work: In my example above, page 10 would be missing, right?

So it'd interweave page 1 of doc A with the last of doc B, etc. until it runs out of pages, and the last page would be page 9 from doc A.

fwenzel commented 9 years ago

fwiw I noticed ranges can already be used as 10-1 which will go backwards. All we'd need to add is a generic "reverse this" format then. -1- like I said above or 0- might work.

Any opinions on which format would be the most intuitive for "reverse this file"?

sockmonk commented 9 years ago

Though I don't immediately see a need for this myself, I think the -1- syntax is intuitive.