Hi Alex
Maybe the following extracts from one of our script helps you. It is
processing heterogeneous pdf input (like too big, too small, landscape
and portrait mixed in one pdf etc.) and standardizes the output to A4.
It needs a few tools: pdftk, gs, convert and tiffcp. The CPU load might
be high during conversion - and conversion might take time for large
documents.
The two methods, PDF->TIFF or PDF->PDF, are independent.
$FN contains the input file (pdf). Output is either $FN\.out.tif or
$FN\.out.pdf .
Method 1, PDF -> TIFF:
[...]
echo `date +%T.%N` Method CONVERTTIFF
echo `date +%T.%N` Splitting PDF...
pdftk $FN burst output $FN\_singlepage_%03d.pdf
convert +dither -density 204x196 $FN\_singlepage_*.pdf -colorspace
GRAY -rotate "-90>" -quality 100 $FN\_%03d.png
rm $FN\_singlepage_*.pdf
convert +antialias +dither $FN\_*.png -adjoin -modulate 80 -level
30% -white-threshold 85% -black-threshold 20% -dither -monochrome -page
A4+0-35 $FN\.out_temp.pdf
rm $FN\_*.png
gs -sDEVICE=tiffg3 -dNOPAUSE -dSAFER -dBATCH -sPAPERSIZE=A4
-dFIXEDMEDIA -r204x196 -sOutputFile=$FN\.out_temp.tif $FN\.out_temp.pdf
tiffcp -c g3 -r -1 -f lsb2msb $FN\.out_temp.tif $FN\.out.tif
rm $FN\.out_temp.*
echo `date +%T.%N` I am done.
[...]
OR, Method 2, PDF -> PDF
[...]
echo `date +%T.%N` Method CONVERTPDF
echo `date +%T.%N` Splitting PDF...
pdftk $FN burst output $FN\_singlepage_%03d.pdf
convert +dither -density 209.10x196 $FN\_singlepage_*.pdf
-colorspace GRAY -rotate "-90>" -quality 100 $FN\_%03d.png
rm $FN\_singlepage_*.pdf
convert +antialias +dither $FN\_*.png -adjoin -modulate 80 -level
30% -white-threshold 85% -black-threshold 20% -dither -monochrome -page
A4 $FN\.out.pdf
rm $FN\_*.png
echo `date +%T.%N` I am done.
[...]
Kind regards, Konrad
Alexander Busam wrote:
Hello,
I'm using Hylafax to send a fax via email (postfix).
How can I resize or shrink a pdf-document automaticaly to the paper size
e. g. A4 ?
Thanks for help :-)
Regards, Alex
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*