I have 1000 groups of 5 pdf files I need to combine/merge. I aware of the "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" command and have created the 1000 different versions of the command I need. Currently I am copying and pasting each separate line into Terminal to run it. Is there a way to put all 1000 lines into a script and run the script.
Thanks
How to combine multiple groups of PDFs using the command line
command linemergepdfterminal
Related Question
- How to combine multiple PDFs using the command line
- MacOS – Automator Combine PDF Application
- MacOS – How to choose printer from command line or from a Python application
- MacOS – How to change the Messages notification sound
- Shell variables in standalone app of bash script
- Combine multiple PDFs into multiple PDFs
Best Answer
The functionality to combine PDFs is built into Preview.app, and this can be a handy approach for dealing with small numbers of documents.
Recent versions of macOS also have a Python script that automates this process for multiple PDF files. This script is located at:
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py
You can run the script directly in Terminal, but it might be handy to add an alias in your
~/.bash_profile
:Instead of typing the long location to the script every time, now you can run this script using a single command! (Don't forget to reload after making changes:
source ~/.bash_profile
.)Say I have a directory of lecture notes
~/Documents/Lectures
that contains the following files:I can combine these PDF files using the following command:
The general usage pattern is listed in the help command:
There is also an extra feature to shuffle pages: