Use Ghostscript (a Homebrew package) to combine PDFs

Howdy folks, I've been trying to learn some how to work with shell scripts lately, so I've been making great use of Homebrew packages to make some basic macros.

My latest one uses Ghostscript (a Homebrew package) to combine multiple PDF files into one single PDF file.

Simply select the PDF files you wish to combine, and in the order you would like them in for the combined file, and trigger the macro. You will be presented with the option to give the output file a custom name, and if you do not supply one it will simply be named "output.pdf".

You also have the option to "debug" the macro by seeing the full command line string instead of running the shell script. This is useful in case the shell script is failing for some reason. Debugging will show you the string, and set it to your clipboard which will allow you to paste it into Terminal to see if it works from there.

Attached are several screen recordings of it in action.

While the macro works quite well for me (and why I posted it here, and not in the Questions and Suggestions category), I'm still interested in everybody's thoughts and ideas if this macro can be improved. Thanks in advance, and if this macro proves useful to anybody else then enjoy!

-Chris

NOTE: This macro has special requirements to run

This macro makes use of the following KM version 10 action(s):
Position next engine window
If you are running a previous version of KM, simply disable or remove said action(s).

This macro requires Homebrew to be installed. Click the link for more info.

This macro requires Ghostscript (a Homebrew package). Click the link for more info.

This macro requires the end-user to set a ENV_PATH variable (or specify the path in the shell script). Click the link for more info.

CURRENT VERSION: 1.1.0 (Friday, February 04, 2022)

v1.1.0: Friday, February 04, 2022
Added an option to debug the macro, displaying and saving the command line string to the clipboard instead of running the shell script

v1.0: Thursday, January 27, 2022
Initial macro

Screen recording without a supplied name (click to expand/collapse)

combine pdf macro default name

Screen recording with a supplied name (click to expand/collapse)

combine pdf macro supplied name

Screen recording of debug feature (click to expand/collapse)

combine pdf macro debug

08)[AS-F] PDFs- Combine.kmmacros (25 KB)

Macro screenshot (click to expand/collapse)

2 Likes

Very convenient and working great, thanks a lot!

1 Like

Oh that's great! Thanks for posting. If you think of any ways it can be improved don't hesitate to let me know. :grin:

1 Like