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-us...@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sa...@ifax.com.*
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
In HylaFAX+ you can create /var/spool/hylafax/etc/FaxModify and in it put:
FIXEDWIDTH="-dPDFFitPage"
Thanks,
Lee.
thanks for the part of your script.
In principle it works well. But in my tests the new generated pdf-file
doesnt fit to an A4-page-size. The size is reduced around 4-fold an when
I sent the document via hylafax one could not read anything.
Also I had problems with the monocrome attribut from the convert-tool
with multible-page documents. I couldn't open the generated pdf-document.
Another question is that I dont know in which config-file of hylafax I
have to add the code.
Thanks for help :-)
Best regards, Alex
thanks for your advise.
Do you know how much efford it is to switch from Hylafax to Hylafax+ ?
I use OpenSuSE 10.3
This works in HylaFAX as well. In fact, you committed it in May 2005!
a.
--
Aidan Van Dyk ai...@ifax.com
Senior Software Developer +1 215 825-8700 x8103
iFAX Solutions, Inc. http://www.ifax.com/
it works.
Thanks a lot.
Regards, Alex