Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[hylafax-users] Resize pdf to document size

119 views
Skip to first unread message

Alexander Busam

unread,
Sep 16, 2008, 8:57:20 AM9/16/08
to Hylafax Users
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-us...@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sa...@ifax.com.*

Konrad Baechler

unread,
Sep 16, 2008, 9:30:16 AM9/16/08
to Alexander Busam, Hylafax Users
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

Andy Rogers

unread,
Sep 16, 2008, 6:49:50 PM9/16/08
to Hylafax Users
Test

Lee Howard

unread,
Sep 20, 2008, 12:00:32 PM9/20/08
to Alexander Busam, Hylafax Users
Alexander Busam wrote:
> How can I resize or shrink a pdf-document automaticaly to the paper
> size e. g. A4 ?


In HylaFAX+ you can create /var/spool/hylafax/etc/FaxModify and in it put:

FIXEDWIDTH="-dPDFFitPage"

Thanks,

Lee.

Alexander Busam

unread,
Sep 23, 2008, 9:47:31 AM9/23/08
to kon...@tensid.ch, Hylafax Users
kon...@tensid.ch schrieb:
>> 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.*
>>
>>
>>
>
>
> ____________________ 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.*
>
>
>
>
Hello Konrad,

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

Alexander Busam

unread,
Sep 23, 2008, 9:51:10 AM9/23/08
to fax...@howardsilvan.com, Hylafax Users
fax...@howardsilvan.com schrieb:

> Alexander Busam wrote:
>
>> How can I resize or shrink a pdf-document automaticaly to the paper
>> size e. g. A4 ?
>>
>
>
> In HylaFAX+ you can create /var/spool/hylafax/etc/FaxModify and in it put:
>
> FIXEDWIDTH="-dPDFFitPage"
>
> Thanks,
>
> Lee.
>
>
>
Hi Lee,

thanks for your advise.

Do you know how much efford it is to switch from Hylafax to Hylafax+ ?

I use OpenSuSE 10.3

Aidan Van Dyk

unread,
Sep 23, 2008, 10:20:19 AM9/23/08
to Lee Howard, Alexander Busam, Hylafax Users
* Lee Howard <fax...@howardsilvan.com> [080920 12:00]:

>
> In HylaFAX+ you can create /var/spool/hylafax/etc/FaxModify and in it put:
>
> FIXEDWIDTH="-dPDFFitPage"

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/

signature.asc

Alexander Busam

unread,
Sep 23, 2008, 10:59:01 AM9/23/08
to ai...@ifax.com, Hylafax Users
ai...@ifax.com schrieb:

> * Lee Howard <fax...@howardsilvan.com> [080920 12:00]:
>
>> In HylaFAX+ you can create /var/spool/hylafax/etc/FaxModify and in it put:
>>
>> FIXEDWIDTH="-dPDFFitPage"
>>
>
> This works in HylaFAX as well. In fact, you committed it in May 2005!
>
> a.
>
>
>
>
Hello Aidan,

it works.

Thanks a lot.

Regards, Alex

0 new messages