Advertisement
theitd

PDF Tidy up [Batch or Bulk]

Apr 8th, 2020
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. # bulk / batch PDF manipulation
  2. # rename based on metdata
  3. pdf-title-rename *.pdf -d /path/to/files -n -i
  4.  
  5. # remove unsafe chars
  6. detox -n -r -v /path/to/files
  7.  
  8. # minor tidy up
  9. rename -n "s/-/ /g" *
  10. rename "s/-/ /g" *
  11. rename "s/  / /g" *
  12. rename "s/?/ /g" *
  13. rename "s/\?/ /g" *
  14.  
  15. # then the icing...
  16. find -type f -name "*.pdf" -exec bash -c 'gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -dQUIET -sOutputFile="new.pdf" "{}"; rm "{}"; mv "new.pdf" "{}";' {} \;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement