[cups.bugs] [HIGH] STR #2251: Reverse print does not work if PPD file has '*OpenUI *OutputOrder:' block

Konstantin Belyanski konst.belyanski at samsung.com
Mon Feb 19 04:55:37 PST 2007


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

### Header
Reverse print does not work if PPD file has '*OpenUI *OutputOrder:' block

### Short description

Reverse print order may be set in lpr command line with
-o outputorder=reverse option. This feature is implemented
in pstops filter and works properly, if PPD file does not
have '*OpenUI *OutputOrder:' block.

If PPD file of the target printer has '*OpenUI *OutputOrder:' block,
output order is always Normal

### Steps to reproduce

### Step 1. Preparation

# Show environment:
cat /etc/issue
-->
Welcome to openSUSE 10.2 (i586) - Kernel \r (\l).

rpm -qa | grep cups-1
-->
cups-1.2.7-3

# Enable print to file
vi /etc/cups/cupsd.conf
# Add line:
FileDevice Yes

# Get sample of two-page Postscript document from:
http://sourceware.org/gdb/current/onlinedocs/refcard.ps.gz
gzip -d refcard.ps.gz

# Get sample of PPD file with '*OpenUI *OutputOrder:' block from:
http://www-personal.umich.edu/~drh/PPDs/Hewlett-Packard%20LaserJet%20IIISi

### Step 2. Test original PPD file WITH '*OpenUI *OutputOrder:' block

# Install printer to print to file:
cp -a Hewlett-Packard_LaserJet_IIISi.ppd /usr/share/cups/model/
lpadmin -p hp3si -m Hewlett-Packard_LaserJet_IIISi.ppd -v
file:///tmp/hp3si.out
lpadmin -p hp3si -E
lpadmin -d hp3si

# Print without command line options:
lpr refcard.ps

# Check page order in output file
grep '(QUICK)h(REFERENCE)\|(including)d(function)\|^%%Page:'
/tmp/hp3si.out

--> Output order is Normal -- OK, it should be so:
%%Page: 1 1
b(QUICK)h(REFERENCE)43 b Fh(GDB)28 b(V)-5 b(ersion)27
%%Page: 2 2
(dula-2)211 -201 y(\(including)d(function)h(calls\),)h(or:)-450

# Print with 'outputorder=reverse' command line options:
lpr -o outputorder=reverse refcard.ps

# Check page order in output file
grep '(QUICK)h(REFERENCE)\|(including)d(function)\|^%%Page:'
/tmp/hp3si.out

--> Output order is Normal -- FAILED, it should be Reverse:
%%Page: 1 1
b(QUICK)h(REFERENCE)43 b Fh(GDB)28 b(V)-5 b(ersion)27
%%Page: 2 2
(dula-2)211 -201 y(\(including)d(function)h(calls\),)h(or:)-450

# Remove printer
lpadmin -x hp3si

### Step 3. Test modified PPD file WITHOUT '*OpenUI *OutputOrder:' block

# Modify PPD file, remove block '*OpenUI *OutputOrder:'
# and save it as Hewlett-Packard_LaserJet_mod.ppd
cp -a Hewlett-Packard_LaserJet_IIISi.ppd Hewlett-Packard_LaserJet_mod.ppd
vi Hewlett-Packard_LaserJet_mod.ppd

# Install printer to print to file:
cp -a Hewlett-Packard_LaserJet_mod.ppd /usr/share/cups/model/
lpadmin -p hp3mod -m Hewlett-Packard_LaserJet_mod.ppd -v
file:///tmp/hp3mod.out
lpadmin -p hp3mod -E
lpadmin -d hp3mod

# Print without command line options:
lpr refcard.ps

# Check page order in output file
grep '(QUICK)h(REFERENCE)\|(including)d(function)\|^%%Page:'
/tmp/hp3mod.out

--> Output order is Normal -- OK, it should be so:
%%Page: 1 1
b(QUICK)h(REFERENCE)43 b Fh(GDB)28 b(V)-5 b(ersion)27
%%Page: 2 2
(dula-2)211 -201 y(\(including)d(function)h(calls\),)h(or:)-450

# Print with 'outputorder=reverse' command line options:
lpr -o outputorder=reverse refcard.ps

# Check page order in output file
grep '(QUICK)h(REFERENCE)\|(including)d(function)\|^%%Page:'
/tmp/hp3mod.out

--> Output order is Reverse -- OK, it should be so:
%%Page: 2 1
(dula-2)211 -201 y(\(including)d(function)h(calls\),)h(or:)-450
%%Page: 1 2
b(QUICK)h(REFERENCE)43 b Fh(GDB)28 b(V)-5 b(ersion)27

# Remove printer
lpadmin -x hp3mod

### Step 4. pstops filter source code investigation. CUPS v.1.2.7.

// File pstops.c

// Lines 2418 .. 2422
  if ((val = cupsGetOption("OutputOrder", num_options, options)) != NULL)
  {
    if (!strcasecmp(val, "Reverse"))
      doc->output_order = 1;
  }

// These lines mean: If CUPS found OutputOrder option and it's value
// is Reverse then assign doc->output_order to 1.
//
// If outputorder is set to reverse in command line of lpr, it will be so.

// Lines 2529 .. 2532
  if (!ppdFindOption(ppd, "OutputOrder") && doc->output_order)
    doc->slow_order = 1;
  else
    doc->slow_order = 0;

// These lines mean: If OutputOrder option was NOT found in PPD file AND
// doc->output_order is non zero then assign doc->slow_order will to 1.
//
// In other words, if option OutputOrder does exist in PPD file, no matter
with which
// value, doc->slow_order will be set to 0 and reverse print never occur.

Latest branch (cups-1.3svn-r6269) pstops.c shows the same behaviour.

Link: http://www.cups.org/str.php?L2251
Version: 1.2.7





More information about the cups-devel mailing list