Bug 689629 - device epswrite sometimes sets too small a bounding box
Summary: device epswrite sometimes sets too small a bounding box
Status: NOTIFIED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Writer (show other bugs)
Version: 8.61
Hardware: PC Windows XP
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-30 03:11 UTC by David Kinniburgh
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kinniburgh 2007-12-30 03:11:01 UTC
gswin32 -sDEVICE=epswrite -q -dBATCH -dNOPAUSE -sOutputFile=out.eps bad.ps

file bad.ps (below) wrongly sets the bounding box to show only the square - the
'title' (= 'bad.ps') centered above it is lost.

file good.ps (below) with a similar structure but different parameters works fine.

GSview(4.9) File|Convert|epswrite works fine even with bad.ps - the title is there.

gswin32 -sDEVICE=bbox bad.ps gives the correct, larger bounding box.

gswin32 -sDEVICE=jpeg -q -r300 -dJPEGQ=100 -dBATCH -dNOPAUSE
-sOutputFile=out.jpg bad.ps     also omits the title. Similar with png, epsi, etc.

#############################################################################

bad.ps

%!PS-Adobe-3.0
%%Pages: (atend)
%%EndComments
%%BeginProlog
/L /lineto load def
/Lend {/Strlen exch stringwidth pop def} def
/LSM {2 copy lineto stroke moveto} def
/M /moveto load def
/mover {Xp Yp moveto} def
/Np {newpath} def
/S /stroke load def
/Sc {setrgbcolor} def
/Setf {Curfnt exch scalefont setfont} def
/SM {stroke moveto} def
/Slw {72.0000 mul setlinewidth} def
/Xposd {/Xpos exch def} def
/xydef {/Xp Xpos def /Yp Ypos def} def
/Xyprset {dup /Xpres exch cos Strlen mul Xpos add def
/Ypres exch sin Strlen mul Ypos add def} def
/Xyprset0 {dup /Xpres exch cos Strlen mul Xpos0 add def
/Ypres exch sin Strlen mul Ypos0 add def} def
/Yposd {/Ypos exch def} def
%%EndProlog
%%Page: 1 1
/Curfnt /Helvetica findfont def
 12 Setf
1.000 1.000 scale
0.000 0.000 0.000 Sc
0.00 0.00 SM
0.00 0.00 translate
/Catx 0 def /Caty 0 def
0.00 Xposd
0.00 Yposd
(Bad.ps) Lend
xydef mover
 0.0 Xyprset
/Catx Xpres Xpos sub Catx add def /Caty Ypres Ypos sub Caty add def
/Xpres 184.543 0.500 Catx mul sub def
/Ypres 800.631 0.500 Caty mul sub def
S
/Xpos Xpres def
/Ypos Ypres def
(Bad.ps) Lend
xydef mover (Bad.ps) show
0.0 Xyprset
 0.000 0.000 0.000 Sc
Np
56.78 511.04 M
312.30 511.04 L
312.30 766.56 L
56.78 766.56 L
56.78 511.04 L
S
stroke showpage
%%Trailer
%%Pages: 1
%%EOF

##########################################################################

good.ps

%!PS-Adobe-3.0
%%Pages: (atend)
%%EndComments
%%BeginProlog
/L /lineto load def
/Lend {/Strlen exch stringwidth pop def} def
/LSM {2 copy lineto stroke moveto} def
/M /moveto load def
/mover {Xp Yp moveto} def
/Np {newpath} def
/S /stroke load def
/Sc {setrgbcolor} def
/Setf {Curfnt exch scalefont setfont} def
/SM {stroke moveto} def
/Slw {72.0000 mul setlinewidth} def
/Xposd {/Xpos exch def} def
/xydef {/Xp Xpos def /Yp Ypos def} def
/Xyprset {dup /Xpres exch cos Strlen mul Xpos add def
/Ypres exch sin Strlen mul Ypos add def} def
/Xyprset0 {dup /Xpres exch cos Strlen mul Xpos0 add def
/Ypres exch sin Strlen mul Ypos0 add def} def
/Yposd {/Ypos exch def} def
%%EndProlog
%%Page: 1 1
/Curfnt /Helvetica findfont def
 12 Setf
1.000 1.000 scale
0.000 0.000 0.000 Sc
0.00 0.00 SM
0.00 0.00 translate
/Catx 0 def /Caty 0 def
0.00 Xposd
0.00 Yposd
(Good.ps) Lend
xydef mover
 0.0 Xyprset
/Catx Xpres Xpos sub Catx add def /Caty Ypres Ypos sub Caty add def
/Xpres 212.934 0.500 Catx mul sub def
/Ypres 687.066 0.500 Caty mul sub def
S
/Xpos Xpres def
/Ypos Ypres def
(Good.ps) Lend
xydef mover (Good.ps) show
0.0 Xyprset
 0.000 0.000 0.000 Sc
Np
85.17 397.48 M
340.69 397.48 L
340.69 653.00 L
85.17 653.00 L
85.17 397.48 L
S
stroke showpage
%%Trailer
%%Pages: 1
%%EOF
Comment 1 Ray Johnston 2007-12-30 19:53:59 UTC
Ghostscript does NOT use the 'bbox' device to determine the BoundingBox with
epswrite, but rather determines the non-white area from the page after it is
rendered.

This PostScript program is flawed because it expects an A4 page, but does
nothing to set the pagesize. Perhaps GSView is setting a different default
page size, or is performing a pre-process 'bbox' pass on the input file.

Ghostscript is working as expected, and is working the same as Adobe CPSI
on this substandard input file (that expects a certain page size, but does not
set it).

This file works fine with:

gswin32 -sPAPERSIZE=a4 -sDEVICE=epswrite -q -dBATCH -dNOPAUSE
-sOutputFile=out.eps bad.ps