Skip to content

Instantly share code, notes, and snippets.

@diegoquintanav
Last active January 17, 2021 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegoquintanav/97b2584ccd973527db7d5d27c93c42b4 to your computer and use it in GitHub Desktop.
Save diegoquintanav/97b2584ccd973527db7d5d27c93c42b4 to your computer and use it in GitHub Desktop.
shrink slides or pdfs to nxm sheets per page
#!/bin/bash
# converts to pdf all txt files in a folder
# and produces a single pdf of all of them together
for filename in $(ls *.txt); do
libreoffice --convert-to "pdf" "$filename"
done
# join all of them in a single pdf
pdftk $(ls *.pdf) cat output output_all.pdf
#!/bin/bash
# prepends the filename to all txt files in a folder:
for filename in $(ls *.txt); do
sed -i.bak "1s;^;${filename}\n;" "$filename"
done
#!/bin/bash
# converts a set of slides to a 3x2 set of slides
# see https://tex.stackexchange.com/questions/557580/pdfjam-or-equivalent-custom-layout-for-multiple-pages-per-sheet
INPUT="$1"
NUP="$2"
pdfnup --suffix "$NUP" --frame True --nup $NUP $INPUT
# usage ./shrink-nxm file.pdf 2x1
# produces a file-2x1.pdf in the same folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment