Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 85182 - ps2pdf chops top or bottom of pages from PS with PageSize command missing
Summary: ps2pdf chops top or bottom of pages from PS with PageSize command missing
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ghostscript
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2003-02-26 10:09 UTC by Alex Butcher
Modified: 2007-04-18 16:51 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2005-04-07 14:30:28 UTC

Attachments (Terms of Use)
.ps file generated by Galeon (558.71 KB, application/octet-stream)
2003-02-27 11:31 UTC, Alex Butcher
no flags Details

Description Alex Butcher 2003-02-26 10:09:45 UTC
Description of problem: ps2pdf fails to cope with PostScript files that are
missing the PageSize command, and chops the bottom or top of the page. This may
be an non-Letter problem only.

Version-Release number of selected component (if applicable):

$ rpm -qf `which ps2pdf`

How reproducible:

Generate an A4 PostScript file without a PageSize command (a print of a webpage
from Galeon should do it) then run ps2pdf on it. You should find that either the
top or the bottom of the page is missing in the resultant PDF file.

Steps to Reproduce:
1.See above.
Actual results:

The top or the bottom of the page is missing in the resultant PDF file.

Expected results:

The page is complete.

Additional info:

Here's a rough n' ready wrapper for ps2pdf that works for me:

ISPS=`head -1 ${1} | grep '^%!PS'`
if [ ! $ISPS ]; then
	# if not a PostScript file then exit
	echo here
	exit 1
	BASENAME=`basename ${1} .ps`
	BBOX=`head -20 ${1} | grep BoundingBox`
	SIZE=`echo $BBOX | awk '{MAXX = 2642; MINX = 595;
              MAXY = 129600; MINY = 595;
              X=$2+$4; Y=$3+$5;
              if (X > MAXX) X=MAXX
              else if ( X < MINX ) X=MINX
              if (Y > MAXY) Y=MAXY
              else if ( Y < MINY ) Y=MINY
              print X+100,Y+100}'`
	sed "/EndComments/a\\
<< /PageSize [ ${SIZE} ] /ImagingBBox null \ >> setpagedevice" ${1} \
	| ps2pdf - $PDFNAME

Comment 1 Tim Waugh 2003-02-26 13:33:16 UTC
Please supply a PS file that demonstrates the problem.  Thanks.

Comment 2 Alex Butcher 2003-02-27 11:31:50 UTC
Created attachment 90394 [details]
.ps file generated by Galeon

Comment 3 Tim Waugh 2003-03-05 17:40:18 UTC
Seems to work fine:

1. ps2pdf register.ps
2. gs register.ps & xpdf register.pdf
3. Compare windows

They look exactly the same, top and bottom, all three pages.

Comment 4 Alex Butcher 2003-03-14 12:49:25 UTC
Not here - note that gv register.ps has a header at the very top of the page
consisting of 'The Register    http://www.theregister.co.uk/', whereas the
ps2pdf'ed version doesn't (in both xpdf and acroread).

If you can't reproduce this, I guess it might be because you've got your system
configured for US (rather than European) paper sizes...

Comment 5 Tim Waugh 2003-03-14 20:36:13 UTC
Oh, *gv*.  You said gs, and that doesn't show that part of the page.

This is nothing to do with ps2pdf; the original PostScript shows incorrectly in
gs as well.

Comment 6 Alex Cherepanov 2005-03-06 20:34:17 UTC
The sample file doesn't set the page size. The page size cannot be
determined from the BoundingBox comment; it shows the size ot the box
that included all printed elements and can have any value.
The problem should be fixed at the source: Galeon .

Comment 7 Tim Waugh 2005-04-07 14:30:28 UTC
We don't ship galeon now.

Note You need to log in before you can comment on or make changes to this bug.