Created
April 1, 2019 05:10
-
-
Save bspavel/8734cef1c559335ab2969dd2177f3117 to your computer and use it in GitHub Desktop.
meta data cleanner
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 | |
#https://gist.github.com/hubgit/6078384 | |
#https://askubuntu.com/questions/260810/how-can-i-read-and-remove-meta-exif-data-from-my-photos-using-the-command-line | |
clean_pdf() { | |
FILE=$1 | |
FILE="${FILE%%.*}" | |
echo "#############" | |
echo $1 | |
echo "#############" | |
if [ -e $1 ] | |
then | |
pdftk $1 dump_data | \ | |
sed -e 's/\(InfoValue:\)\s.*/\1\ /g' | \ | |
pdftk $1 update_info - output ${FILE}.clean.pdf | |
exiftool -all:all= ${FILE}.clean.pdf | |
exiftool -all:all ${FILE}.clean.pdf | |
exiftool -extractEmbedded -all:all ${FILE}.clean.pdf | |
qpdf --linearize ${FILE}.clean.pdf ${FILE}.clean2.pdf | |
pdftk ${FILE}.clean2.pdf dump_data | |
exiftool -all=${FILE}.clean.pdf | |
exiftool -all=${FILE}.clean2.pdf | |
exiftool ${FILE}.clean2.pdf | |
echo "#############" | |
echo "Metadatos de fichero "${FILE}.clean2.pdf | |
pdfinfo -meta ${FILE}.clean2.pdf | |
echo "#############" | |
else | |
echo "File not found!" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment