[gs-devel] Convert PDF to PS - Automatic page rotation to Portrait
Lakos Dániel
dlakos at nicro.hu
Sat Nov 7 02:23:18 PST 2009
Hi,
Im using Hylafax, which can only send portrait documents, but theres a
need to fax landscape PDFs as well.
So I need a solution to detect page orientation and rotate the document
to portrait, if its landscape.
Portrait pages should be left alone...
Ive found a solution in the GS archives, and the rotation works as it
should, but some text are malformed/characters missing after conversion.
Does Anybody have an idea whats wrong?
Is there any other method to "auto rotate" pages?
My GhostScript Version is 8.15.
Thank You in Advance,
Daniel
The solution I use, is the following.
-----------------------------------------------------------------------------
gs -sOutputFile=out.ps \
-sDEVICE=pswrite \
-dBATCH -dNOPAUSE -dSAFER=true \
autorotate.ps \
in.pdf
-----------------------------------------------------------------------------
autorotate.ps:::::
%!PS
% Sequence to set up for a single page size, auto fit all pages.
<< /Policies << /PageSize 3 >>
/InputAttributes currentpagedevice /InputAttributes get %current
dict
dup { pop 1 index exch undef } forall % remove all page sizes
dup 0 << /PageSize [ 595 842 ] >> put % for A4 use [ 595 842 ]
>> setpagedevice
-----------------------------------------------------------------------------
More information about the gs-devel
mailing list