Swift scripts for PDF manipulation, for Shortcuts or Terminal
Since Apple got rid of a python installation that you can rely on in MacOS, our choices for 'out-of-the-box' scripting are limited. AppleScript? No thanks. Perl and Ruby are still there, but who knows for how long?
However, it is possible to use Swift as a scripting language! It's slow as a brick, compared to python, but it works.
And, Apple has provided a mechanism for running Swift scripts in Shortcuts. So I'm translating my python scripts for PDF manipulation into Swift.
You'll find them in the scripts folder.
HOWEVER -- using Swift raises the possibility of creating a command line tool -- 'pdfutil' -- with subcommands and flags for the various actions and options in the scripts. That's the end-goal.