Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 565776

Summary: CUPS does not pass papersize info to ghostscript backend
Product: Red Hat Enterprise Linux 5 Reporter: Harald Milz <harald.milz>
Component: ghostscriptAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: QE Internationalization Bugs <qe-i18n-bugs>
Severity: high Docs Contact:
Priority: low    
Version: 5.4CC: ktakemur, llim, pknirsch, tao, vbenes
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ghostscript-8.70-1.el5 Doc Type: Bug Fix
Doc Text:
Due to an error in the pxlmono driver, an incorrect page size may have been used when attempting to print a document with a size other than the default US Letter. With this update, Ghostscript now always retains the correct page size.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 22:06:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 560096    
Bug Blocks:    
Attachments:
Description Flags
/var/log/cups/error_log
none
it says DefaultPageSize: A4 none

Description Harald Milz 2010-02-16 09:17:30 UTC
Created attachment 394483 [details]
/var/log/cups/error_log

Description of problem:

We're trying to print to various Windows network printer shares which default to A4 paper size. The default papersize for ghostscript is US Letter, though, and there seems no simple way to pass the actual paper size to ghostscript, except modifying gs_init.ps which isn't an option in a future 5-digit workstation environment. 

The printer was defined with "lpadmin ... -o PaperSize=a4", lpoptions shows "media=A4".

What works (where HPLaserJ is a raw port 9100 printer without filtering):

1. gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -sDEVICE=pxlmono -r600x600 -sPAPERSIZE=a4 -sOutputFile=- /usr/share/cups/data/testprint.ps | lpr -P HPLaserJ

2. export GS_OPTIONS="-sPAPERSIZE=a4"
gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -sDEVICE=pxlmono -r600x600 -sOutputFile=- /usr/share/cups/data/testprint.ps | lpr -P HPLaserJP

3. Set DEFAULTPAPERSIZE in /usr/share/ghostscript/8.15/lib/gs_init.ps

what does not work: 

1. lpr /usr/share/cups/data/testprint.ps
lpr -o media=A4 /usr/share/cups/data/testprint.ps
lpr -o media=a4 /usr/share/cups/data/testprint.ps

2. setting /etc/papersize = a4

The cups error_log shows that the papersize option is not passed to the gs backend, hence gs always uses its default paper size. Although uncommenting the DEFAULTPAPERSIZE option in gs_init.ps works for A4, this is not an option because then the paper size is fixed to A4 and one can't print other sizes e.g. A3. The correct behaviour would be to pass a correct papersize option to gs, either from lpoptions or lpr -o media=a4 or whatever. 

The same is true if printing from an application like Firefox, OpenOffice, Lotus Symphony, no difference. 

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

cups-1.3.7-11.el5

How reproducible:

always

Steps to Reproduce:
1. see above
2.
3.
  
Actual results:

tries to print US Letter which fails on A4 printers; printer has to be reset or overridden manually.

Expected results:

should print A4 or whetever size is passed in a printing application 

Additional info:

please see attached cups error log. It clearly shows that the page size is set to A4 in various places but not passed to gs.

Comment 1 Tim Waugh 2010-02-16 09:37:39 UTC
Please attach the PPD you are using, /etc/cups/ppd/FS008IC9-HPLaserJ.ppd.

Comment 2 Harald Milz 2010-02-16 09:43:06 UTC
Created attachment 394487 [details]
it says DefaultPageSize: A4

Comment 3 Tim Waugh 2010-02-16 12:53:32 UTC
Seems to be a ghostscript problem.  The filter chain looks like this:

testpage -> pstops -> foomatic -> ghostscript

By running the chain all the way through to ghostscript, and sending the output through ghostscript-8.70-5.fc12 on Fedora 12 before sending it on to the printer tagged as raw, the job comes out correctly as A4.

Comment 4 Harald Milz 2010-02-16 15:45:15 UTC
Can you also deliberately set other page sizes? Methinks CUPS should invoke gs with the proper -sPAPERSIZE= option. In our case gs even rendered as US Letter where it said A4 in the Postscript file.

Comment 5 Tim Waugh 2010-02-16 16:20:34 UTC
The -sPAPERSIZE option is not meant to be required for this driver (pxlmono).

The page size is set in the PostScript input file using PostScript commands from the PPD's PageSize/PageRegion options.  For this driver, that means:

<</PageSize[595 842]/ImagingBBox null>>setpagedevice

That PostScript fragment *is* being inserted into the input stream, but for some reason is not functioning correctly for this driver.

Comment 6 Harald Milz 2010-02-16 16:58:24 UTC
If RHEL 5.4 needs an update package to correct this, is there any way to provide ESP Ghostscript 8.15.3 or later? That would also resolve another problem that we have (http://www.linuxfoundation.org/collaborate/workgroups/openprinting/database/driverpackages#Distributions_which_are_only_LSB-3.1_compliant). The one we use is 8.15.2-9.11.el5, and we need to install the Postscript-Lexmark package. 

Anyway, there is also a service request for this one (1994946). Maybe you can consolidate the work.

Comment 9 Harald Milz 2010-07-15 19:40:12 UTC
8.70-1 for el5, wow. Thanks!

Comment 10 Harald Milz 2010-07-16 06:19:18 UTC
Hi, I don't find ghostscript-8.70-1.el5 in RHN,  only -5.el6 ... where should I find it?

Comment 12 Tim Waugh 2010-07-16 12:10:18 UTC
Please be patient while the package undergoes internal testing.

Comment 13 Jaromir Hradilek 2010-07-20 09:58:58 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
Due to an error in the pxlmono driver, an incorrect page size may have been used when attempting to print a document with other size than the default US Letter. With this update, Ghostscript now always retains the correct page size.

Comment 16 Jaromir Hradilek 2011-01-10 00:54:34 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Due to an error in the pxlmono driver, an incorrect page size may have been used when attempting to print a document with other size than the default US Letter. With this update, Ghostscript now always retains the correct page size.+Due to an error in the pxlmono driver, an incorrect page size may have been used when attempting to print a document with a size other than the default US Letter. With this update, Ghostscript now always retains the correct page size.

Comment 18 errata-xmlrpc 2011-01-13 22:06:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0137.html