Sha256: 0c4f5dc4a7769d9e8421318203c6b5a78583b22e4a126b51cd286ed723a549de
Contents?: true
Size: 527 Bytes
Versions: 7
Compression:
Stored size: 527 Bytes
Contents
#!/bin/bash if [ -z "$2" ]; then echo "Usage: ./convert_to_text.sh in.pdf out.txt"; exit 1; fi INPUT=$1 OUTPUT=$2 TYPE=`file -b --mime-type "$INPUT"` if [[ "$TYPE" == "text/plain" ]]; then cp "$INPUT" "$OUTPUT"; elif [[ "$TYPE" == "application/pdf" && -n `which pdftotext` ]]; then pdftotext -raw -enc UTF-8 "$INPUT" "$OUTPUT"; elif [[ "$TYPE" == "application/postscript" && -n `which ps2ascii` ]]; then ps2ascii "$INPUT" > "$OUTPUT"; elif [[ -n `which abiword` ]]; then abiword -t txt "$INPUT" -o "$OUTPUT"; fi
Version data entries
7 entries across 7 versions & 1 rubygems