Use gs to check page count before sending
This commit is contained in:
parent
93e37156d8
commit
e05bfac110
10
fax.sh
10
fax.sh
|
@ -63,6 +63,16 @@ then
|
||||||
echo "File too big. Cannot be more than 10MB."
|
echo "File too big. Cannot be more than 10MB."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
if hash gs 2>/dev/null
|
||||||
|
then
|
||||||
|
if [ $(gs -q -dNODISPLAY -c "(fax.pdf) (r) file runpdfbegin pdfpagecount = quit" 2>&1) -gt 30 ]
|
||||||
|
then
|
||||||
|
echo "Sipgate won't send your file, because it has more than 30 pages"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "ghostscript not installed, cannot check for page numbers. Sipgate accepts up to 30 pages."
|
||||||
|
fi
|
||||||
#Needs to be base64 encoded:
|
#Needs to be base64 encoded:
|
||||||
CONTENT=$(base64 "$FILE" -w 0)
|
CONTENT=$(base64 "$FILE" -w 0)
|
||||||
if [ -z "$CONTENT" ];
|
if [ -z "$CONTENT" ];
|
||||||
|
|
Loading…
Reference in a new issue