File: pdf2pnga

package info (click to toggle)
latex2rtf 2.3.18a-5
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,392 kB
  • sloc: ansic: 20,424; makefile: 660; sh: 478; perl: 22
file content (48 lines) | stat: -rwxr-xr-x 1,391 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!bash
# Part of latex2rtf by Wilfried Hennings (Oct 2007)
# usage: pdf2pnga pdf_input_file png_output_file density
# echo "pdf2pnga" $1 $2 $3 $4 $5 >> pdf2pnga.log

if [ -z "$1" ] ; then
    echo " "
    echo "!!! pdf2pnga: error: no input file specified !!!"
    exit 1
fi

if [ -z "$2" ] ; then
    echo " "
    echo "!!! pdf2pnga: error: no output file specified !!!"
    exit 1
fi

# does the input file exist?
if [ ! -f "$1" ] ; then
    echo " "
    echo "!!! pdf2pnga: error: input file $1 not found !!!"
    exit 1
fi

if [ -z $3 ] ; then 
    dpi=300
else
    dpi=$3
fi

# Under DOS, Ghostscript isn't available at all.
# Under Windows, the executable is named gswin32c.exe
# The use of the _.at file is necessary because of the 
# restricted command line length under Windows.
# The way to do this was taken over from the batch files 
# in the Ghostscript distribution for Windows.

if which gswin32c.exe >NUL ; then
   echo -dNOPAUSE -dBATCH -dSAFER -sDEVICE#pngalpha -r$dpi >_.at
   gswin32c -q "-sOutputFile#$2" @_.at "$1"
   rm -f _.at
elif [ -e /usr/bin/sips ] ; then 
#  If sips is available (which is the case in newer MacOSX systems), then use it.
   /usr/bin/sips -s format png -s dpiHeight $dpi -s dpiWidth $dpi --out "$2" "$1" 
else
   gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -r$dpi "-sOutputFile=$2" "$1" 
fi