Advertisement
Guest User

Untitled

a guest
Jul 1st, 2011
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. #!/bin/bash
  2. # Extracts image files from PDF files
  3.  
  4. if [ ! -f "${i}" ]; then
  5.   echo "${i} does not exist!"
  6.   exit 1
  7. fi
  8.  
  9. pdf_file="${1}"
  10. directory="$(echo ${1} | sed -e 's/\.pdf$//')"
  11.  
  12. mkdir -p "${directory}"
  13. pdfimages -j "${pdf_file}" "${directory}"/PDFImage
  14. if [ $? -eq 0 ]; then
  15.   echo "Images were successfully extracted!"
  16.   exit 0
  17. else
  18.   echo "I failed"
  19.   exit 1
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement