sajad torkamani

Install pdfunite

brew install poppler

Combine PDFs explicitly

pdfunite 1.pdf 2.pdf 3.pdf combined.pdf

Combine all files in a directory

pdfunite $(ls -v *.pdf) combined.pdf

If you need order, give the file names a numeric prefix such as 1. Some file, 2. Another file.

Optional: Decrypt files

If you get an error like this:

Unimplemented Feature: Could not merge encrypted files ('10-04-2021-11-05-2021.pdf')

You can decrypt the files using qpdf:

ls *.pdf | sort | xargs -I '{}' qpdf --decrypt {} --replace-input 

Then run the above command again:

pdfunite $(ls -v | sort *.pdf) combined.pdf
Tagged: macOS