pdfsam icon indicating copy to clipboard operation
pdfsam copied to clipboard

[Feature request] Re-ordering pages from a booklet PDF

Open maxiride opened this issue 8 years ago • 1 comments

I'd like to suggest a new feature which reorder the pages from a scanned booklet. A booklet (as the name suggest) comes in set of pages folded in the middle and inserted inside one in another. booklet

When unfolding a booklet we obtain separate sheets which doesn't contain the pages in the correct reading order. Assuming a 2 sheets booklet (8 pages) the first sheet will contain the pages (front\back of the sheet) 1-8, 2-7; the second sheet will have page 3-6,4-5 as shown: unfolded

Saying that we can already split the pages from each sheet we can obtain a PDF containing the pages in this order: 8,1,2,7,6,3,4,5. pdfsam already has a manual reordering tool which theoretically could be used to solve this issue, but I'd like to suggest an auto-sorting feature for the cases where the pages are many more than just 8 to obtain a PDF with the pages in the correct reading order. sorted

An user on this forum already made a little algorithm to solve this issue, but at least for me it isn't straightforward, having this little addition to pdfsam could make it a "point and click" solution for noobs :smile:

Edit: to avoid reading all the thread here is the code he made (thought to be run in excel as I understood)

Sub Macro1()
' by rumeyj

Dim i As Integer, lastPg As Integer
Dim extN As String, othN As String

lastPg = Cells(2, 2).Value 'this cell B2 is where the total number of pages is input

If lastPg Mod 4 > 0 Then lastPg = lastPg + 4 - (lastPg Mod 4)

Range("a5:a100").Clear
Range("A4").Select

For i = 1 To lastPg / 2
    extN = Format(i, "00")
    othN = Format(lastPg - i + 1, "00")

If i Mod 2 Then 'i is odd
    'Debug.Print i; "i is odd"
    PonNextLine ("rename e" & extN & ".jpg " & othN & ".jpg")
    PonNextLine ("rename o" & extN & ".jpg " & extN & ".jpg")
Else
    PonNextLine ("rename e" & extN & ".jpg " & extN & ".jpg")
    PonNextLine ("rename o" & extN & ".jpg " & othN & ".jpg")
End If
Next i
End Sub

Function PonNextLine(ln As String)
'print on next line
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = ln
End Function

maxiride avatar Nov 02 '15 15:11 maxiride

Been out of the loop for a while, is this feature rejected?

maxiride avatar Dec 15 '20 10:12 maxiride