Forked from hannesfrank/beamer-pdf-remove-pause-slides.sh
Last active
November 5, 2023 10:34
-
-
Save blustrini/6daf8c936fa11962a9eb0776eb18b943 to your computer and use it in GitHub Desktop.
Remove partial slides from latex-beamer pdf presentations.
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
#!/usr/bin/env sh | |
# code adapted from: | |
# https://gist.github.com/hannesfrank/35f4472c8294ddeb26055672d2114bd9 | |
# for windows change shebang possibly? | |
# and figure out how to install pdftk? | |
# apologies, I dont use windows :( | |
if [[ $# -eq 0 ]] ; then | |
echo 'usage:' ${0##*/} '<input pdf> <output pdf>' | |
exit 0 | |
fi | |
IN_PDF=$1 | |
OUT_PDF=$2 | |
pdftk $IN_PDF cat $(\ | |
pdftk $IN_PDF dump_data \ | |
| grep PageLabelNewIndex `# filter page labels`\ | |
| cut -d' ' -f2 `# get label number`\ | |
| tail -n +2 `# skip first line`\ | |
| awk '{print ($1 - 1)}' `# subtract one to get previous page`\ | |
) end \ | |
output $OUT_PDF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment