Skip to content

Instantly share code, notes, and snippets.

@thekalinga
Last active April 17, 2021 00:25
Show Gist options
  • Save thekalinga/97f59ab2c8f6d3c3547962ddf2596a03 to your computer and use it in GitHub Desktop.
Save thekalinga/97f59ab2c8f6d3c3547962ddf2596a03 to your computer and use it in GitHub Desktop.
Convert png, jpg files to pdf, combine them into a merged pdf
# Code for downloading Google books is present in tts-converter/DownloadGoogleBooks.kt
for i in $(find . -maxdepth 1 -name "*.png" -print | sort -V -k1); do pdfjam --outfile ${i//png/pdf} $i; done
for i in $(find . -maxdepth 1 -name "*.jpg" -print | sort -V -k1); do pdfjam --outfile ${i//jpg/pdf} $i; done
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=merged.pdf -dBATCH `find . -maxdepth 1 -name "*.pdf" -print | sort -V -k1`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment