apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.93k stars 464 forks source link

Wrong page size with laserjet.ppd #1794

Closed michaelrsweet closed 17 years ago

michaelrsweet commented 18 years ago

Version: 8.15-current CUPS.org User: twaugh.redhat

Not sure where exactly the problem is here, but the printer asks for Letter paper when an A4 job was sent. It's not a hardware configuration issue: I can see in the error_log that Letter page size is sent.

Original bug report: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=191601

The problem comes when using the laserjet.ppd.gz PPD that ships with CUPS, although the problem might be in pstoraster or somewhere else.

michaelrsweet commented 18 years ago

CUPS.org User: mike

Please get a copy of the PostScript file the user is using to test with. The PS file is apparently setting the media size to Letter - the pstops filter is reporting the (correct) default media size A4...

michaelrsweet commented 18 years ago

CUPS.org User: mike

OK, I just tested things with the PPD file, output.ps file, current pstops filter, and ESP Ghostscript 7.07.1 and 8.15.x - the older ESP Ghostscript produced an A4 raster image, but 8.15.x produced a letter-sized raster image.

This is an ESP Ghostscript bug, not a CUPS bug...

michaelrsweet commented 18 years ago

CUPS.org User: mike

OK, the policy stuff they added is the cause of the problem. Policy "3" means "select the nearest page size", which for a Ghostscript driver means the default size (which is letter).

I've attached a patch that seems to fix things for this test file (basically matching policy 3 to impose the size...)

michaelrsweet commented 17 years ago

"str1794.patch":

Index: src/zmedia2.c

--- src/zmedia2.c (revision 188) +++ src/zmedia2.c (working copy) @@ -345,99 +345,24 @@

 if ((rx <= 0) || (ry <= 0))
return_error(e_rangecheck);

- && ry - medium->p.x >= -5 && ry - medium->q.x <= 5;

- double temp = rx;