/useful/trunk-1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/useful/trunk-1

« back to all changes in this revision

Viewing changes to scripts/pdf2images.sh

  • Committer: Gustav Hartvigsson
  • Date: 2024-07-10 21:07:31 UTC
  • Revision ID: git-v1:7631e167e18af814d7b1d6d9d4118e64e4afa741
* useful.inc.sh
  - changed from '-gt' to '>' in __find_tool ()

* process_text_to_image.sh
  - use function library

* pdf2images.sh
  - use function library

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
__SANITY=true
18
18
__HAS_OPTIPNG=false
19
19
 
 
20
__SCRIPT_ROOT=$(dirname $(readlink -f $0))
 
21
source $__SCRIPT_ROOT/useful.inc.sh
 
22
 
20
23
function __usage () {
21
24
  echo "pdf2images.sh --- Convert a range of pdf pages into pngs."
22
25
  echo "USAGE:"
24
27
  echo ""
25
28
}
26
29
 
27
 
function __silent () {
28
 
  $@ >> /dev/null 2>&1
29
 
  return $?
30
 
}
31
 
 
32
30
function __sanity_check () {
33
31
  # Check that we have the tools needed.
34
 
  __silent which pdftoppm 
35
 
 
36
 
  if [ $? -gt 0 ]; then
37
 
    echo "    Can't find tool \"pdftoppm\" (Required)."
38
 
    __SANITY=false
39
 
  fi
 
32
  __find_tool pdftoppm
40
33
 
41
34
  __silent which optipng
42
35
  if [ $? -gt 0 ]; then
45
38
  fi
46
39
  
47
40
  if [[ $__SANITY == false ]]; then
 
41
    echo ""
48
42
    echo "Please install the missing tools."
49
43
    echo ""
50
44
    exit 1