Add side stitch booklet rearrangement
This commit is contained in:
parent
00210b75c7
commit
da7f0561cb
2 changed files with 17 additions and 2 deletions
|
@ -52,7 +52,7 @@ public class RearrangePagesPDFController {
|
|||
}
|
||||
|
||||
private enum CustomMode {
|
||||
REVERSE_ORDER, DUPLEX_SORT, BOOKLET_SORT, ODD_EVEN_SPLIT, REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST,
|
||||
REVERSE_ORDER, DUPLEX_SORT, BOOKLET_SORT, SIDE_STITCH_BOOKLET_SORT, ODD_EVEN_SPLIT, REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST,
|
||||
}
|
||||
|
||||
private List<Integer> removeFirst(int totalPages) {
|
||||
|
@ -114,6 +114,18 @@ public class RearrangePagesPDFController {
|
|||
return newPageOrder;
|
||||
}
|
||||
|
||||
private List<Integer> sideStitchBooklet(int totalPages) {
|
||||
List<Integer> newPageOrder = new ArrayList<>();
|
||||
for (int i = 0; i < (totalPages + 3) / 4; i++) {
|
||||
int begin = i * 4;
|
||||
newPageOrder.add(Math.min(begin + 3, totalPages - 1));
|
||||
newPageOrder.add(Math.min(begin, totalPages - 1));
|
||||
newPageOrder.add(Math.min(begin + 1, totalPages - 1));
|
||||
newPageOrder.add(Math.min(begin + 2, totalPages - 1));
|
||||
}
|
||||
return newPageOrder;
|
||||
}
|
||||
|
||||
private List<Integer> oddEvenSplit(int totalPages) {
|
||||
List<Integer> newPageOrder = new ArrayList<>();
|
||||
for (int i = 1; i <= totalPages; i += 2) {
|
||||
|
@ -135,6 +147,8 @@ public class RearrangePagesPDFController {
|
|||
return duplexSort(totalPages);
|
||||
case BOOKLET_SORT:
|
||||
return bookletSort(totalPages);
|
||||
case SIDE_STITCH_BOOKLET_SORT:
|
||||
return sideStitchBooklet(totalPages);
|
||||
case ODD_EVEN_SPLIT:
|
||||
return oddEvenSplit(totalPages);
|
||||
case REMOVE_FIRST:
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<option value="REVERSE_ORDER">Reverse Order</option>
|
||||
<option value="DUPLEX_SORT">Duplex Sort</option>
|
||||
<option value="BOOKLET_SORT">Booklet Sort</option>
|
||||
<option value="SIDE_STITCH_BOOKLET_SORT">Side Stitch Booklet Sort</option>
|
||||
<option value="ODD_EVEN_SPLIT">Odd-Even Split</option>
|
||||
<option value="REMOVE_FIRST">Remove First</option>
|
||||
<option value="REMOVE_LAST">Remove Last</option>
|
||||
|
|
Loading…
Reference in a new issue