Bug 85182 - ps2pdf chops top or bottom of pages from PS with PageSize command missing
ps2pdf chops top or bottom of pages from PS with PageSize command missing
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: ghostscript (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-02-26 05:09 EST by Alex Butcher
Modified: 2007-04-18 12:51 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-04-07 10:30:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Alex Butcher 2003-02-26 05:09:45 EST
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`
ghostscript-7.05-20

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.
2.
3.
    
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:

#!/bin/sh
ISPS=`head -1 ${1} | grep '^%!PS'`
if [ ! $ISPS ]; then
	# if not a PostScript file then exit
	echo here
	exit 1
else
	BASENAME=`basename ${1} .ps`
	PDFNAME=`echo $BASENAME.pdf`
	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
fi
Comment 1 Tim Waugh 2003-02-26 08:33:16 EST
Please supply a PS file that demonstrates the problem.  Thanks.
Comment 2 Alex Butcher 2003-02-27 06:31:50 EST
Created attachment 90394 [details]
.ps file generated by Galeon
Comment 3 Tim Waugh 2003-03-05 12:40:18 EST
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 07:49:25 EST
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 15:36:13 EST
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 15:34:17 EST
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 10:30:28 EDT
We don't ship galeon now.

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