Created
June 23, 2020 17:01
-
-
Save Nezteb/e761bb85ced6ce965e37d54ceb04635d to your computer and use it in GitHub Desktop.
Replace text in a PDF
This file contains hidden or 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
#!/bin/bash | |
PDF_FILE=$1 | |
TITLE="${PDF_FILE%.*}" | |
TEMP1="${TITLE}_q.pdf" | |
TEMP2="${TITLE}_qr1.pdf" | |
TEMP3="${TITLE}_qr2.pdf" | |
TEMP4="${TITLE}_qr3.pdf" | |
qpdf --qdf --object-streams=disable $PDF_FILE $TEMP1 | |
LC_ALL=C sed -e 's/some text//g' <$TEMP1 >$TEMP2 | |
LC_ALL=C sed -e 's/some more text//g' <$TEMP2 >$TEMP3 | |
LC_ALL=C sed -e 's/even more text//g' <$TEMP3 >$TEMP4 | |
rm -f $PDF_FILE | |
rm -f $TEMP1 | |
rm -f $TEMP2 | |
rm -f $TEMP3 | |
mv $TEMP4 $PDF_FILE% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment