fwenzel / stapler

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

need to deal with logical page numbers #8

Open jheidemann opened 5 years ago

jheidemann commented 5 years ago

A feature request:

stapler needs to deal with logical page numbers in addition to physical page numbers. That is, if my document starts with page i, ii, iii, iv before 1, I need to know that logical page iv is physical page 4, and logical page 1 is physical page 5.

It turns out logical page numbers are... fun .... in PDF. In addition, logical page numbers are hard to integrate with stapler syntax, since it assumes page ranges are always in the form 1-2 or 1-end.

As a first step, I implemented a new command list-logical code that lists the logical page numbers and what the corresponding physical page is. A skilled user can use shell programming this list to tell stapler what physical pages to change.

jheidemann commented 5 years ago

I have submitted a patch and a pull request against hellerbarde/stapler.

I cannot submit a pull request here because I cannot clone twice with the same name.

However, I ported my patch to the fwenzel version and am attaching a patch that applies cleanly against the current fwenzel/stapler.

jheidemann commented 5 years ago

list-logical.patch.txt