Discussion:
GhostScript: PDF to TIFF conversion with page resize
(too old to reply)
Francesco
2004-04-27 13:32:38 UTC
Permalink
I'm trying to convert PDF files to multipage TIFF files using
GhostScript 8.00. I need to build a command line which can be called
programatically in a batch job (so I can't use GSView to do the work).

I successfully managed to convert the files but I can't figure out how
to scale the output to fit the -sPAPERSIZE I set (A4). If I use
-dFIXEDMEDIA the page are not scaled but cropped. GSView can scale the
pages, so I know it's possible, but how does it do this?

I tried to add to my command line the following parameters:

-c "<< /Policies << /PageSize 5 >> /PageSize [595 842]
/InputAttributes << 0 /PageSize [595 842] >> >> >> setpagedevice" -f

But the output is not scaled. I currently use the following command
line:

c:\gs\gs8.14\bin\gswin32c.exe -r300 -dNOPAUSE -dNOPAGEPROMPT -dBATCH
-sFONTPATH=C:\WINNT\fonts -sDEVICE=tiffg4 -sPAPERSIZE=a4
-sOutputFile=%1.tif %1

Thank you.
Russell Lang
2004-04-28 09:28:01 UTC
Permalink
Post by Francesco
I'm trying to convert PDF files to multipage TIFF files using
GhostScript 8.00. I need to build a command line which can be called
programatically in a batch job (so I can't use GSView to do the work).
I successfully managed to convert the files but I can't figure out how
to scale the output to fit the -sPAPERSIZE I set (A4). If I use
-dFIXEDMEDIA the page are not scaled but cropped. GSView can scale the
pages, so I know it's possible, but how does it do this?
GSview uses a ghostscript specific ViewerPreProcess hook in
setpagedevice to ignore all attempts to change the page size,
resolution or orientation. GSview reads the media size from
the PDF file using ghostscript, and sets the page size, resolution
and orienation to suit the viewing window.
Post by Francesco
-c "<< /Policies << /PageSize 5 >> /PageSize [595 842]
/InputAttributes << 0 /PageSize [595 842] >> >> >> setpagedevice" -f
But the output is not scaled.
This one only scales (shrinks) if the PDF page is larger than A4.

Why do you need to scale the PDF to A4 size?
Does setting the resolution give you near enough to a suitable size
raster file?
Francesco
2004-04-28 14:32:02 UTC
Permalink
Thank you for you answer.

Starting from a PDF with pages larger than an A4 I want to obtain a
TIFF as large as an A4. GSView can do this (File->Convert...) but I
can't figure out how it does it.
Francesco
2004-04-30 08:46:04 UTC
Permalink
Is there any other ng I could ask this question?
Helge Blischke
2004-04-30 13:25:09 UTC
Permalink
Post by Francesco
Is there any other ng I could ask this question?
Dunno.

Using Ghostscript, I'd suggest using the /BeginPage procedure in the
page device dictionary to scale (resize) the pages as desired.

Helge
--
***@srz-berlin.de
***@srz-berlin.com
***@acm.org
Francesco
2004-05-27 09:17:45 UTC
Permalink
Dear Russel Lang,

You are the creator of GSView; could you please explain to me how does
GSView resize the output page during a format conversion? Can it be
done by issuing particular command line commands to ghostscript?

My problem:

I have PDFs with pages larger than A4

I want to obtain TIFF with pages as large as an A4

So I have to resize; GSView has the "Shrink to fit page size" option
(which is exactly what I need to do): how does it shrink the page? I
can't use GSView because I have to do batch conversions.

Can you please help me?

Thank you.
Francesco
2004-05-28 08:47:12 UTC
Permalink
Ok, I finally managed to solve the problem -dDEVICEWIDTH=2479
-dDEVICEHEIGHT=3508 -dPDFFitPage switchs).

Loading...