Sometimes, one has to roll their own tool. The following Python-Objective C application will take the name of your PDF on the command line, and write out the PDF with the pages reversed and the name "_reversed" appended to the basename.
Because Python is indent sensitive, I do not recommend copy/pasting the following content into a TextEdit or a word processing application as these will destroy the indent structure. Recommend a know programmer's editor that supports Python syntax, and an example is BBEdit where after copying this code, you use the BBEdit edit menu : Paste > and Match Indentation. Save the file as pdfrev.py on your Desktop. BBEdit is trialware that after the trial it becomes free to use with fewer features. This Python script is for Apple's Cocoa bridge in Python 2.7.16:
#!/usr/bin/python
# coding: utf-8
# write a PDF with its pages reversed into name_reversed.pdf
# tested with Python 2.7.10 on macOS High Sierra 10.13.6, Python 2.7,16 on 10.14.6
# VikingOSX, 2019-01-19, Apple Support Communities, No warranties.
from Foundation import NSURL
from Quartz.PDFKit import PDFDocument
import os
import sys
def usage():
print("Usage: {} file1.pdf … filen.pdf".format(__file__))
def main():
if len(sys.argv) < 2:
usage()
sys.exit(1)
for apdf in sys.argv[1:]:
pdf_file = os.path.expanduser(apdf)
if not pdf_file.endswith('.pdf'):
raise Exception('PDF file type required')
# build output PDF filename
bpath, ext = os.path.splitext(pdf_file)
pdfrev = os.path.basename(bpath + '_reversed' + ext)
url = NSURL.fileURLWithPath_(pdf_file)
pdf = PDFDocument.alloc().initWithURL_(url)
pdf_out = PDFDocument.alloc().init()
if pdf.pageCount() == 1:
sys.exit('only one page found')
# n is sequential page increase, r is the reversed page number
for n, r in enumerate(reversed(range(0, pdf.pageCount()))):
pdf_out.insertPage_atIndex_(pdf.pageAtIndex_(r), n)
pdf_out.writeToFile_(pdfrev)
if __name__ == '__main__':
sys.exit(main())
In the Terminal, change directory to your Desktop, make this Python script executable, and run it providing the name of the PDF on your Desktop whose pages you want reversed. This will not re-order existing page numbers in the PDF, if present.
cd ~/Desktop
chmod +x ./pdfrev.py
./pdfrev.py ./pdftoreverse.pdf
The output PDF will be on your Desktop as ./pdftorevers_reversed.pdf — using the example name here.