Created
April 20, 2023 13:53
-
-
Save Zeta611/f7ea2b22b53e802ec267c811eb926316 to your computer and use it in GitHub Desktop.
[Merge PDFs] #automation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if qpdf is installed | |
if ! command -v qpdf >/dev/null; then | |
echo "qpdf not found. Please install qpdf and try again." | |
exit 1 | |
fi | |
# Check if enough arguments are supplied | |
if [ "$#" -lt 3 ]; then | |
echo "Usage: $0 output.pdf input1.pdf input2.pdf [input3.pdf ...]" | |
exit 1 | |
fi | |
# Get output file name | |
output_file="$1" | |
shift | |
# Merge input PDF files | |
qpdf --empty --pages "$@" -- "$output_file" | |
echo "Merged PDFs saved as $output_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment