49 lines
814 B
Plaintext
49 lines
814 B
Plaintext
|
|
#!/bin/bash
|
||
|
|
# This file converts a set of pdf files into a
|
||
|
|
# secondo relation containing single pages and
|
||
|
|
# double pages as relation attributes
|
||
|
|
#
|
||
|
|
|
||
|
|
if [ -z $1 ]; then
|
||
|
|
echo " Missing object name "
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
NAME=$1
|
||
|
|
shift
|
||
|
|
|
||
|
|
# write the relation header
|
||
|
|
|
||
|
|
echo "( OBJECT $NAME () "
|
||
|
|
echo "( rel (tuple ("
|
||
|
|
echo " ( File string )"
|
||
|
|
echo " ( IsDoublePage bool )"
|
||
|
|
echo " ( FirstPage int)"
|
||
|
|
echo " ( ThePage text)"
|
||
|
|
echo " ( Content text )"
|
||
|
|
echo " )))"
|
||
|
|
echo " ( " # open tuple list
|
||
|
|
if [ -z $1 ]; then # no files given, read from stdin
|
||
|
|
read file
|
||
|
|
while [ "$file" ]; do
|
||
|
|
echo "Process File " $file >&2
|
||
|
|
extractPages -secondo $file
|
||
|
|
read file
|
||
|
|
done
|
||
|
|
|
||
|
|
else
|
||
|
|
for file in $*
|
||
|
|
do
|
||
|
|
echo "Process File " $file >&2
|
||
|
|
extractPages -secondo $file
|
||
|
|
done
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "))" # close tuple list and object
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|