Usage: Copy the pdfs that you want to flatten into this folder ./pdfflatten.sh file.pdf or bash pdfflatten.sh Wait some minute or hours depending on the number of pdfs or pdf size, it's done!