Created
May 10, 2022 05:19
-
-
Save HirbodBehnam/42a957c077923179fd374eb4a49a26d0 to your computer and use it in GitHub Desktop.
Merge pdf files with gostscript and TOC
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
# From https://stackoverflow.com/a/56154217/4213397 | |
for file in *.pdf; do | |
filename="${file%.*}" | |
gs -o "${filename}_toc.pdf" -sDEVICE=pdfwrite -c "[/Title ($filename) /OUT pdfmark" -f "$file" | |
done | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=final.pdf *_toc.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment