Correctly ordering pages in PDF (based on footer page numbers)

I have a multi-page pdf which is out of order. Each page footer shows the correct page number, but the order is (for example): Page 2, Page 3, Page 1. Any thought on an automated process on the Mac to move the pages into correct order based on the Page number?

The out-of-order pdf is a result of a workflow that splits a multi-page pdf into single page pdfs, renames them, then merges the pdfs that belong together. I can manually reorder the pages using drag and drop, but I’d like to automate this final step because: automation.

I’m wondering the best solution would actually take part during this process - for example naming the files as "page number - correct name", then they should merge in the right order. Would that work at all?

Thanks for the idea. What I have right now before merging is Bob.pdf, Bob-1.pdf, Bob-2.pdf, where Bob.pdf may be page 1, 2, or 3 as indicated by the page# printed in the footer. So I would need to rename them somehow before merging. I’m playing with different Hazel methods, but I’m open to ideas :slight_smile:

Thanks again, @RosemaryOrchard. After a bit more fiddling, it looks like either manually renaming the files before merging or manually dragging to reorder are the best approaches. As much as I want to crack this puzzle, I’m trying to stay :muscle: and resist because it’s not worth the time :slight_smile:

Well, I just couldn’t let it go so I thought I’d report back that I figured it out. Before merging, I added a couple Hazel rules using “contain match” on the contents to find the Page # and used it to rename the files to end with _1, _2, _3… while also stripping out the existing -1,-2,-3… so I end up with Bob_1.pdf, Bob_2.pdf, etc. Thanks, @RosemaryOrchard for the suggestion to handle the ordering before merging!

1 Like

I had a feeling it was doable! Glad you got it working, I’d have dug into it myself but I’ve been travelling (and am still on my way home!) :grin:

[I know you cracked this later on with Hazel… ] You certainly don’t want to be renaming lots of files manually >> can use A Better Finder Renamer for some of that:

http://www.publicspace.net/ABetterFinderRename/